Doc #60770 [Opn]: Add Note to Documentation

From: Date: Wed, 02 May 2012 07:19:27 +0000
Subject: Doc #60770 [Opn]: Add Note to Documentation
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8324@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=60770&edit=1 ID: 60770 Updated by: uw@php.net Reported by: david_colter at me dot com Summary: Add Note to Documentation Status: Open Type: Documentation Problem Package: Documentation problem Operating System: Linux PHP Version: Irrelevant -Assigned To: +Assigned To: philip Block user comment: N Private report: N New Comment: Philip, can you decide on it? In my eyes the documentation is clear enough, no change needed. Please close thebug report if you concur. "Return Values Returns the number of affected rows on success, and -1 if the last query failed. If the last query was a DELETE query with no WHERE clause, all of the records will have been deleted from the table but this function will return zero with MySQL versions prior to 4.1.2. When using UPDATE, MySQL will not update columns where the new value is the same as the old value. This creates the possibility that mysql_affected_rows() may not actually equal the number of rows matched, only the number of rows that were literally affected by the query. The REPLACE statement first deletes the record with the same primary key and then inserts the new record. This function returns the number of deleted records plus the number of inserted records." Previous Comments: ------------------------------------------------------------------------ [2012-01-16 14:57:33] david_colter at me dot com Description: ------------ --- From manual page: http://www.php.net/function.mysql-affected-rows#refsect1- function.mysql-affected-rows-returnvalues --- The documentation for Return Values is missing one important Note. It is possible for the return value to be '2' for Update or '1' for Insert, when using a query like: "INSERT INTO table ( field_1, ... ) VALUES ( 'abc', ... ) ON DUPLICATE KEY UPDATE field_1 = 'abc', ... WHERE key_field = 12345" Test script: --------------- NA Expected result: ---------------- NA Actual result: -------------- NA ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=60770&edit=1

« previous php.doc.bugs (#8324) next »