note 9475 deleted from mysql_affected_rows by danbeck

From: Date: Thu, 08 Mar 2001 21:16:40 +0000
Subject: note 9475 deleted from mysql_affected_rows by danbeck
Groups: php.notes 
Request: Send a blank email to php-notes+get-12066@lists.php.net to get a copy of this message
mysql_affected_rows() is very slow. I have a loop that updates thousands of rows or inserts them if they do not exist. It may seem good to do an UPDATE and then check to see if any rows were affected. If not, do an INSERT. However, it is much faster to do a SELECT _first_ and do an UPDATE if the record(s) are they or do an INSERT otherwise.

« previous php.notes (#12066) next »