note 42517 deleted from function.mysql-affected-rows by danbrown
| From: | danbrown@php.net | Date: | Tue, 28 Apr 2009 01:50:52 +0000 |
| Subject: | note 42517 deleted from function.mysql-affected-rows by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153878@lists.php.net to get a copy of this message | ||
Note Submitter: sam_dot_fullman_at_verizon.nt
----
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.