#42956 [Opn->Bgs]: insert_id doesnt work with stored procedures
| From: | jani@php.net | Date: | Mon, 15 Oct 2007 10:13:16 +0000 |
| Subject: | #42956 [Opn->Bgs]: insert_id doesnt work with stored procedures | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-118541@lists.php.net to get a copy of this message | ||
ID: 42956
Updated by: jani@php.net
Reported By: phlcastro at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: MySQLi related
Operating System: Linux
PHP Version: 5.2.4
New Comment:
This is actually MySQL bug:
http://bugs.mysql.com/bug.php?id=25111
Previous Comments:
------------------------------------------------------------------------
[2007-10-13 17:34:23] phlcastro at gmail dot com
Description:
------------
I tired with stored procedures and it did not worked out.
here is what i tried:
$mysqli = connection1();
$mysqli->autocommit(FALSE);
$user = "call insert_user('hello', 'mypass','myemail')";
$mysqli->query($user);
printf ("New Record has id %d.\n", $mysqli->insert_id);
$mysqli->commit();
exit;
Output:
New Record has id 0.
which is not correct, may be problem is with stored procedures.
Reproduce code:
---------------
$mysqli = connection1();
$mysqli->autocommit(FALSE);
$user = "call insert_user('hello', 'mypass','myemail')";
$mysqli->query($user);
printf ("New Record has id %d.\n", $mysqli->insert_id);
$mysqli->commit();
exit;
Expected result:
----------------
the id number
Actual result:
--------------
0
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=42956&edit=1