note 6835 deleted from mysql_affected_rows by ronabop

From: Date: Thu, 02 Nov 2000 08:26:14 +0000
Subject: note 6835 deleted from mysql_affected_rows by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-7274@lists.php.net to get a copy of this message
I have noticed that the mysql_affected_rows(); function can be at best unpredictable. This is what works for me: <PRE> $sql = "DELETE FROM table WHERE id='$id'"; $r = mysql_query($r); if(@mysql_affected_rows() > 0){ echo 'Delete successful!'; }else{ echo 'What Happened?'; } </PRE> The @mysql_affected_rows() has no $r (putting a result index in there seems to screw things up from my experiences) and also sports an '@' to suppress warnings (I would get these all the time even with good queries).

« previous php.notes (#7274) next »