Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem updating row 1

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
It doesn't update the row at all. Also, script.php?file=EntryEdit&id=$id doesn't call $id in the URL.

Code:
function do_edit_entry($id, $entry_name, $entry_email, $entry_url, $entry_msn, $entry_aim, $entry_icq, $entry_yahoo, $entry_message) {

global $admin, $prefix, $dbi;

$result = sql_query("update ".$prefix."_guestbook set name='$entry_name', email='$entry_email', url='$entry_url', msn='$entry_msn', aim=$entry_aim', icq='$entry_icq', yahoo='$entry_yahoo', message='$entry_message', date='$entry_date', time='$entry_time', ip='$entry_ip' where id='$id'", $dbi);

Header("Location: script.php?file=EntryEdit&id=$id");

}

What's wrong? :-(
 
nivly, you have a trailing bracket on the query, remove it.

$query = "update guestbook set name='$entry_name', email='$entry_email', url='$entry_url', msn='$entry_msn', aim=$entry_aim', icq='$entry_icq', yahoo='$entry_yahoo', message='$entry_message', date='$entry_date', time='$entry_time', ip='$entry_ip' where id='$id')"; ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Thank you, KarveR, and everyone else SOOO much. Removing that bracket fixed it! :)
 
NP, fresh eyes always help at times :) ______________________________________________________________________
There's no present like the time, they say. - Henry's Cat.
 
Your closing parenthesis is in the wrong place. Your parentheses should enclose only the value set in the VALUES clause. The WHERE clause should not be enclosed in the parentheses, as it is a separate clause from the VALUES clause.

Nivly, that is why I deliberately placed commit point number four in my recommendations. If you had cut and pasted that string into, for example, MySQLFront, you would have seen that the string produces an error. And MySQL would have done it's best to tell you the nature of the error.

From this, I infer that you didn't even bother with commit point 4. Again, you seem to have reverted to trying things at random.


Nivly, troubleshooting is a slow, arduous process. It requires attention to detail, and a methodical mindset. Experienced programmers only make it look quick, and seem to jump around, because they can perform the steps very quickly and using shortcuts their years' of experience provide them. ______________________________________________________________________
Don't say thanks. Just award stars.
______________________________________________________________________
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top