Jump to content


Photo

How to verify a successful UPDATE?


  • Please log in to reply
2 replies to this topic

#1 bilis_money

bilis_money
  • Members
  • PipPipPip
  • Advanced Member
  • 621 posts

Posted 23 August 2006 - 12:05 PM

let say i have updated the table records successfully with these codes below.
$query = "UPDATE topics SET title='$$title_tmp', escription='$descrip_tmp', url='$url_tmp' WHERE title='$title_tmp'";
mysql_query($query) or die("Update failed!<br>".mysql_error());

ok, let say the query was executed and the mysql_error() didn't throw me an error message and means it was updated successfully.
now how do i check this if it is really was successful?

i know i can compare the $title_tmp both previous data and in the newly modified submitted data in the table.

But i'm hoping that you have better solution ideas than this of mine.
What is your style?

Advance lightning THANKS 2 YOU all my PHP comrades... :)



#2 Orio

Orio
  • Staff Alumni
  • Advanced Member
  • 2,491 posts

Posted 23 August 2006 - 12:38 PM

Why shouldn't it work if no error was outputed?
If you really want to double check (tho I find it a waste of resources), select the rows you updated and compare with the variables...

Orio.
Think you're smarty?

(Gone until 20 to November)

#3 448191

448191
  • Staff Alumni
  • Advanced Member
  • 3,545 posts
  • LocationNetherlands

Posted 23 August 2006 - 01:10 PM

The manual (sigh..):

mysql_affected_rows()




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users