php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42956 insert_id doesnt work with stored procedures
Submitted: 2007-10-13 17:34 UTC Modified: 2007-10-15 10:13 UTC
From: phlcastro at gmail dot com Assigned:
Status: Not a bug Package: MySQLi related
PHP Version: 5.2.4 OS: Linux
Private report: No CVE-ID: None
 [2007-10-13 17:34 UTC] 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

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-15 10:13 UTC] jani@php.net
This is actually MySQL bug:

http://bugs.mysql.com/bug.php?id=25111

 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Apr 16 21:01:28 2024 UTC