Best way to do this?
I was wondering if I could get some advice/examples.
I have a dataset that contains production information for every week of the year. I need to display this weekly information to the screen. The user, can then change what is displayed and based on this input I recalculate the information for that week.
The kicker is, I dont want to write anything to the database. Its more like a sandbox for the users to test various scenarios. How can I let the user manipulate data, preform calculations based on the manipulate data, but not actually write anything to the database?
The only way I see is to store the data in flat files. I don't think there is any other way.
Or, if you don't need to keep the data permanently, you can just store everything in the RAM and not write anything to the disk (database or flat files). This way all data will be lost when you reboot your server (or when it crashes).
You might also be able to just copy the data to a new database, and then change the database connection details so it operates on the copy. This could be done per user, with the connection details stored in a session or the like.
This information doesnt need to be saved. When you say store it RAM, do you just mean assign all the data to an array or something and just play with that data?
Originally Posted by risoknop
Yes, for instance. That way you can access the data until the server goes down - it all depends on your web hosting, if it's good, you can go even few days without a reboot.
Originally Posted by tdob
So now that I have actually started on this, I am not 100% clear on how to accomplish this task.
I have an array containing the sql data I need. Upon displaying this data, a user can change a value. However, how can I update the specific value in the array that the user wants to change? Like how can I tell the array I only want to update a certain value, my head keeps thinking in MySQL query terms with update statements but I obviously cant do that with an array.
loop through the array searching for the element which needs to be changed. When you find it, change it.