|
Posted by fox.whisper on 03/09/07 07:53
On 8 Mar 2007 19:04:22 -0800, "Kenoli" <kenoli.p@gmail.com> wrote:
>I am displaying a long list of records from a mysql database in a kind
>of spreadsheet format with records making up the rows and fields the
>columns. The reason for this is that users have a need to scroll
>through a lot of records and edit a thing here or there in a text
>field, checkbox, etc.
How many records?
How often does this happen?
>
>The way I have it set up is that when they are through, they perform a
>submit and all records are updated. There are some problems with
>this, including the fact that if someone gets to this page in a way
>that no data is displayed and hits update, they could erase the whole
>database.
I don't understand how that could happen... "someone gets to thispage
in a way that no data is dispayed"???
>
>Is there any way to update only the records that have been changed?
>As this is kind of a client side thing, I'm suspecting that javascript
>may be the tool here; I know that it would be possible using AJAX.
>But I'm wondering if there is some way to only select the $_POST
>elements that have been changed. I can think of some complicated ways
>like storing the orignal data in session variables and comparing the
>new POST data with the old session data, or having the user check a
>box next to the changed records (they could easily miss a record and
>lose changes) or check a set of records and move them to a new page
>where they alone are updated (this is less convenient for the user).
>I'm wondering if there is any simpler, more elegant way.
I do this all the time in the various databases I run -
1 - display all the records, allowing inspection for errorneous data,
2 - let the user choose which record needs updated by clicking on an
id number (or such), which then...
3 - bring the selected record(s) to screen in a web form which
displays all the data and allows correcting of any and every field,
4 - store the result back in the table, allowing either the edited
record to overwrite the original or mking the visitor having to delete
the original record manually.
Ok, so it's a bit naive and a bit more laboured than your way, but it
doesn't allow the nightmare of anybody deleting all the records in
one fell swoop(!).
[Back to original message]
|