Solved

Only show specific fields updated in database from form

Posted on 2011-02-24
7
348 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:Bruce Smith
Bruce Smith earned 250 total points
ID: 34976629
Can you show the code that sends the email to the admin?
0
 
LVL 19

Accepted Solution

by:
Michael701 earned 250 total points
ID: 34976638
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:Bruce Smith
ID: 34976676
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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 

Author Comment

by:katlees
ID: 34979924
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
ID: 34979931
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:Bruce Smith
ID: 34980419
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
ID: 34980543
PatSmitty - if we did that, if the changes are accepted - how do we move the changes to the correct fields?
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

813 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