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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: phlcastro at gmail dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 17 01:01:33 2025 UTC