Solved

Only show specific fields updated in database from form

Posted on 2011-02-24
7
347 Views
Last Modified: 2012-05-11
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
Comment
Question by:katlees
  • 3
  • 3
7 Comments
 
LVL 11

Assisted Solution

by:patsmitty
patsmitty earned 250 total points
Comment Utility
Can you show the code that sends the email to the admin?
0
 
LVL 19

Accepted Solution

by:
Michael701 earned 250 total points
Comment Utility
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
 
LVL 11

Expert Comment

by:patsmitty
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:katlees
Comment Utility
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
 

Author Closing Comment

by:katlees
Comment Utility
Thanks guys. You answered my question just from your comments. I'll see what I can do with the seperate tables.
0
 
LVL 11

Expert Comment

by:patsmitty
Comment Utility
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
 

Author Comment

by:katlees
Comment Utility
PatSmitty - if we did that, if the changes are accepted - how do we move the changes to the correct fields?
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Suggested Solutions

This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now