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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
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-2024 The PHP Group
All rights reserved.
Last updated: Thu Dec 26 19:01:30 2024 UTC