[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 357
  • Last Modified:

Only show specific fields updated in database from form

I have a form someone can fill out to be listed on a website. The user submits their data and an email is sent to admin for approval. Admin approves it and the listings is added to the website.

If the user comes in and updates a couple of fields and submits it to the admin again - we have the listing coming off the site until the admin can approve the changes. Question is - is there a way when the admin goes in - to see the fields that were updated so they know what to look for? Maybe make them a different color?
0
katlees
Asked:
katlees
  • 3
  • 3
2 Solutions
 
Bruce SmithSoftware Engineer IICommented:
Can you show the code that sends the email to the admin?
0
 
Michael701Commented:
What you don't want to do is remove the previous approved data just because they submitted a change request.

Write the changed fields to a separate table. then it will be easy to display the current data with the requested changes.
0
 
Bruce SmithSoftware Engineer IICommented:
Hence my request for code. Whether to see if it's coming from a pending table or the actual user table. Either way, there should be a way to differentiate between the previously approved data and the updated data. Being able to see the code would help to provide a specific solution.

Cheers
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
katleesAuthor Commented:
That basically answers my question. I have to write to a seperate table to show changes then compare the temporary table with the live table to see if they match or not. If they don't, show in a different color.

Thanks!
0
 
katleesAuthor Commented:
Thanks guys. You answered my question just from your comments. I'll see what I can do with the seperate tables.
0
 
Bruce SmithSoftware Engineer IICommented:
Another option is to create a new varchar field in the user table called something like 'pending_field_changes' and then input the updated fields and their values as a delimited string of some kind. So if the user table looks like this:

user_id
user_name
user_email
user_phone
pending_field_changes

And the user updates his email and phone, you could write the query like so:
UPDATE user SET pending_field_changes = 'user_phone~555-444-3333|user_email~email@server.com' 
WHERE user_id = 'some_id';

Open in new window

And then when you pull the pending information out you could explode the string by the '|' character and then you could get the column name from each of those by exploding them by the '~' character.

I hope this makes sense. You can do this which is fairly simple, or you could just create a temp table.

Cheers
0
 
katleesAuthor Commented:
PatSmitty - if we did that, if the changes are accepted - how do we move the changes to the correct fields?
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 3
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now