php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69400 Wrong documentation for mysqli insert_id
Submitted: 2015-04-08 23:43 UTC Modified: 2017-04-03 15:08 UTC
From: imbacen at gmail dot com Assigned: peehaa (profile)
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
 [2015-04-08 23:43 UTC] imbacen at gmail dot com
Description:
------------
---
From manual page: http://www.php.net/mysqli.insert-id
---
The documentation for mysqli insert_id is wrong. It says that function will return zero if query was not INSERT or UPDATE but in fact it will return the last inserted ID. The function seems to be just a wrapper for http://php.net/manual/en/function.mysql-insert-id.php where the documentation is correct and even warns that the value is NOT reset after each query.

See discussion: http://stackoverflow.com/questions/29526374/mysqli-insert-id-still-returning-a-value-even-after-select-queries

Test script:
---------------
See: http://stackoverflow.com/questions/29526374/mysqli-insert-id-still-returning-a-value-even-after-select-queries

Expected result:
----------------
It should state the same as docs for mysql_insert_id()


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2015-04-13 09:52 UTC] peehaa@php.net
-Assigned To: +Assigned To: peehaa
 [2017-04-03 15:08 UTC] peehaa@php.net
-Status: Assigned +Status: Closed -Package: *General Issues +Package: Documentation problem
 [2017-04-03 15:08 UTC] peehaa@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 12:01:31 2024 UTC