Hello, I want to display the fields that were updated.

When a user edits their information, example;

  "FIRST NAME:John
    LAST NAME: Stih

    Update to:UPDATE users SET firstname = '$firstname', lastname = '$lastname'

    FIRST NAME: John
    LAST NAME: Smith

I would want it to print

"You updated your Last name"

Recommended Answers

What do you have so far?

Jump to Post

All 3 Replies

Just the UPDATE and SET query.

$firstname = mysql_real_escape_string(trim(stripslashes($_POST['firstname'])));
$lastname = mysql_real_escape_string(trim(stripslashes($_POST['lastname'])));

$query = "UPDATE users SET firstname = '$firstname', lastname = '$lastname';
    if (mysql_affected_rows() == 1) {
    print '<p>Your info has been updated.</p>';}
    else{ print "Didn't Update";}

You just need PHP code to compare the old values with the new ones.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.