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 Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or 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

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: Thu Apr 18 16:01:29 2024 UTC