note 33644 added to function.mysql-affected-rows

From: Date: Wed, 02 Jul 2003 21:08:55 +0000
Subject: note 33644 added to function.mysql-affected-rows
Groups: php.notes 
Request: Send a blank email to php-notes+get-51384@lists.php.net to get a copy of this message
My little work around for the update problem (that I ran into): if (mysql_affected_rows()==0) { $q = "select .. WHERE ...<search for what you updated>'"; if (mysql_num_rows(mysql_query($q))==0) die("0 rows affected"); else echo "Record Alredy Existed"; } It is probably not the best way, as I sometimes run 2 queries for the same thing, but it gets the job done. ---- Manual Page -- http://www.php.net/manual/en/function.mysql-affected-rows.php Edit Note -- http://master.php.net/manage/user-notes.php?action=edit+33644 Delete Note -- http://master.php.net/manage/user-notes.php?action=delete+33644&report=yes Reject Note -- http://master.php.net/manage/user-notes.php?action=reject+33644&report=yes

« previous php.notes (#51384) next »