Bug #54142 [NEW]: the function mysqli_insert_id doesn't return the last id
| From: | lissetteganoza at gmail dot com | Date: | Wed, 02 Mar 2011 21:42:18 +0000 |
| Subject: | Bug #54142 [NEW]: the function mysqli_insert_id doesn't return the last id | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-159171@lists.php.net to get a copy of this message | ||
From:
Operating system: windows
PHP version: 5.2.17
Package: PHP options/info functions
Bug Type: Bug
Bug description:the function mysqli_insert_id doesn't return the last id
Description:
------------
---
From manual page: http://www.php.net/mysqli.insert-id#Descripción
---
The function mysqli_insert_id does not return the if of the last insert.
The
query was executed without problem but I can get the id of this insert. I
want to
konw if exist other function other possiblity, maybe I need to reconfigure
some
value in the php ini, but I need a solution and this solution must be in
the
documents of this funcionality.
I'm adding the function that I have for insert a row.
Test script:
---------------
function insert($ins)
{
$result = @mysqli_query($this->conn,$ins);
if (!$result)
{
$this->writeTemplate(DB_TITULO_ERROR,mysqli_error());
}
return @mysqli_insert_id($this->conn);
}
Expected result:
----------------
- A solution to use correctly this function
- Id does not exist a solution with this function, another solution with
other
functions of mysql
Actual result:
--------------
the function returns a empty object.
--
Edit bug report at http://bugs.php.net/bug.php?id=54142&edit=1
--
Try a snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=54142&r=trysnapshot52
Try a snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=54142&r=trysnapshot53
Try a snapshot (trunk): http://bugs.php.net/fix.php?id=54142&r=trysnapshottrunk
Fixed in SVN: http://bugs.php.net/fix.php?id=54142&r=fixed
Fixed in SVN and need be documented: http://bugs.php.net/fix.php?id=54142&r=needdocs
Fixed in release: http://bugs.php.net/fix.php?id=54142&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=54142&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=54142&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=54142&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=54142&r=support
Expected behavior: http://bugs.php.net/fix.php?id=54142&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=54142&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=54142&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=54142&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=54142&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=54142&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=54142&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=54142&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=54142&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=54142&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=54142&r=mysqlcfg