SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Best way to do this?

    Hi,

    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?

  2. #2
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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).

  3. #3
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by risoknop View Post
    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).
    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?

  4. #4
    SitePoint Guru risoknop's Avatar
    Join Date
    Feb 2008
    Location
    end($world)
    Posts
    834
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tdob View Post
    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?
    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.

  5. #5
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  6. #6
    SitePoint Addict
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    373
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.

  7. #7
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    loop through the array searching for the element which needs to be changed. When you find it, change it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •