Jump to content

Update Table ONLY if the value has changed


blackdogupya

Recommended Posts

I have no idea if this is possible or not, but I've got a form that searches a DB for a record.

 

If that record is found, it displays a form that people can edit the record.

 

Now, if that person wants to change (for example) 1 record out of 16 called "status" from "lost" to "found" but leave all the rest as they are, how would I go about this?

 

Basically, I need to check all the fields ON SUBMIT if they're different from the original values in the DB and only update if they are.

 

Any help would be appreciated.

 

Cheers,

 

Dave

Link to comment
Share on other sites

you could check your form values against the returned values and build your update query to refference only the fields that don't match the original database return.  if you are doing this over multiple pages you would want to put your database return into a session variable for easier access on the second page.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.