PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Database » MDB2_Driver_mysqli » Bug #7506

Problem with lastInsertID function

Details

Submitted2006-04-27 19:03 UTC
Frommiker at laynemorgan dot com
StatusNo Feedback
PackageMDB2_Driver_mysqli
PHP Version5.0.5
OSWindows
Roadmaps(Not assigned)

Comments

[2006-04-27 19:03 UTC] miker at laynemorgan dot com

Description:
------------
The function 'lastInsertID' of class MDB2_Driver_mysqli which extends MDB2_Driver_Common always returns 0.

Test script:
---------------
Line 896 of MDB2\Driver\mysqli.php =
$value = @mysqli_insert_id($connection);

Should be changed to
$value = $connection->insert_id;

As $connection is a mysqli object

[2006-04-29 15:18 UTC] miker at laynemorgan dot com

Yes, things worked once I switched the code to $connection->insert_id

I always try to use the mysqli extension where possible, however using the code as is, the method lastInsertID would always return 0 for me.

[2006-04-29 15:24 UTC] miker at laynemorgan dot com

No, I haven't used the mysqli extension directly, however I am trying to use MDB_QueryTool which uses MDB2 (as specified when initializing the object).

I will try and run the test suite in a little bit and get back to you with my results.