note 42517 added to function.mysql-affected-rows
| From: | sam_dot_fullman_at_verizon dot nt at rn2 dot php dot net | Date: | Wed, 19 May 2004 16:12:41 +0000 |
| Subject: | note 42517 added to function.mysql-affected-rows | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-69838@lists.php.net to get a copy of this message | ||
Just a MySQL note, using REPLACE INTO on a record could return either ONE or TWO affected rows with
this function. Basically, REPLACE INTO will insert a record if no combination of unique keys is
matched, or delete the existing record if the new record matches one or more unique keys, then
insert the new record over it.
This is actually helpful if you want to know if a record was already in there. (Affected rows=1
means there wasn't already a record there, Affected rows=2 means there was), but if you
don't know how REPLACE INTO works it could confuse you. I didn't see this in the notes
above and hope it helps someone out.
----
Manual Page -- http://www.php.net/manual/en/function.mysql-affected-rows.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+42517
Delete -- http://master.php.net/manage/user-notes.php?action=delete+42517&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+42517&report=yes
Search -- http://master.php.net/manage/user-notes.php