Hi everyone, new web developer here working on a big project, in need of a bit of advice.
To make this very simple, I'm making a database for utility meter readings for a group of apartment complexes. I'm mostly not having any issues, but they want a way to be able to roll back the data in case any mistakes are made. I figured it wouldn't be too hard to automatically record the current version of the data every time someone clicks "save", but I can't think of an elegant way to do it. Will I have to create a new table for the data every time someone clicks "save" or is there a better way to do it?
Please ask if you need any clarification. Thanks for helping!
- Matt
Saving Versions of Data
Moderator: General Moderators
-
Number1SuperGuy
- Forum Newbie
- Posts: 10
- Joined: Thu Jun 17, 2010 11:21 am
Re: Saving Versions of Data
Real simple.
In your table where you're recording the transactions have the following fields
id - (auto number field)
resident_id - obviously from your table of residents.
date - date field
reading - The meter reading for that period.
This way you can track historic data by querying all the entries from a particular resident and do it in date order. And a mistake is easy enough to fix, you just query the date and update the number.
In your table where you're recording the transactions have the following fields
id - (auto number field)
resident_id - obviously from your table of residents.
date - date field
reading - The meter reading for that period.
This way you can track historic data by querying all the entries from a particular resident and do it in date order. And a mistake is easy enough to fix, you just query the date and update the number.
Re: Saving Versions of Data
Instead of editing the rows, you add a column to track the "revision" #. Then instead of editing a row you just insert a new row with a higher revision number.
-
kamak malik
- Forum Newbie
- Posts: 1
- Joined: Sun Jul 11, 2010 8:12 am
Re: Saving Versions of Data
it just about saving data.........oh yes i like it