note 9475 added to mysql_affected_rows
| From: | jason at familynet dot net | Date: | Mon, 06 Nov 2000 05:22:51 +0000 |
| Subject: | note 9475 added to mysql_affected_rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-7425@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.
http://www.php.net/manual/function.mysql-affected-rows.php