#50171 [Opn->Bgs]: Code behaviour different from documentation

From: Date: Fri, 13 Nov 2009 19:33:27 +0000
Subject: #50171 [Opn->Bgs]: Code behaviour different from documentation
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-3113@lists.php.net to get a copy of this message
ID: 50171 Updated by: vrana@php.net Reported By: rapsys at free dot fr -Status: Open +Status: Bogus Bug Type: Documentation problem Operating System: debian lenny/sid PHP Version: 5.2.11 New Comment: I can't see anything wrong with the documentation. Previous Comments: ------------------------------------------------------------------------ [2009-11-13 19:04:30] rapsys at free dot fr The note paragraph should be changed too. ------------------------------------------------------------------------ [2009-11-13 19:03:30] rapsys at free dot fr Description: ------------ This documentation don't work anymore for mysql inserted id function. «The ID generated for an AUTO_INCREMENT column by the previous INSERT query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established.» Right now the behaviour has changed, the mysql_inserted_id return alway 0 if last query on the connexion was an update, delete, select or a failed query. Tested on php 5.2.4 and the code behaviour is documented in mysqli function, so the documentation should be wrong since few versions Reproduce code: --------------- --- From manual page: function.mysql-insert-id#Notes --- Code : connect to db query with a working insert see x as inserted id query a update see 0 as inserted id query a failed insert see 0 as inserted id Expected result: ---------------- The value of the AUTO_INCREMENT field that was updated by the previous query. Returns zero if there was no previous query on the connection or if the query did not update an AUTO_INCREMENT value. Behaviour changed in php version X.Y.Z Actual result: -------------- The ID generated for an AUTO_INCREMENT column by the previous INSERT query on success, 0 if the previous query does not generate an AUTO_INCREMENT value, or FALSE if no MySQL connection was established. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=50171&edit=1

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