Re: checking if a MySQL update worked

From: Date: Tue, 01 Oct 2002 01:55:01 +0000
Subject: Re: checking if a MySQL update worked
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-118288@lists.php.net to get a copy of this message
If result is true, I take this to mean that the query could be executed. And I take MySQL affected rows to mean that N rows were affected AND the result was true: <? $sql = "SELECT * FROM ..."; $result = mysql_query($sql); if($result) { // it did work echo mysql_affected_rows(); } else { // it didn't work echo mysql_error(); } ?> I haven't dug right down to make sure this method works for every problem, but so far, no problems found. Justin French on 01/10/02 2:23 AM, Henry (henry@teacake.f9.co.uk) wrote: > Hi All, > > mysql_affected_rows() returns zero if you update without changing the data > in a database record. How do you tell the difference betwix "it worked but > nothing changed" as opposed to "it didn't work"? > > TIA > > Henry > >

« previous php.general (#118288) next »