|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #416 mysql_insert_id() always returns 0
Submitted: 1998-05-29 16:32 UTC Modified: 1998-06-01 13:09 UTC
From: steve at eyekon dot com Assigned: rasmus (profile)
Status: Closed Package: MySQL related
PHP Version: 3.0 Release Candidate 5 OS: Solaris2.6
Private report: No CVE-ID: None
 [1998-05-29 16:32 UTC] steve at eyekon dot com
I use the following code to insert a new row with
autoincrement field in mysql:

$query = "Insert into cart_user (uname,upass,email) ";
$query .= "values ('$uname','$upass','$email')";
$insert = mysql($database,$query);
$user_id = mysql_insert_id();

When I display $user_id, it is 0.

What am I doing wrong?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [1998-06-01 13:09 UTC] rasmus
Confirmed to be user error.
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Tue Jun 25 07:01:26 2019 UTC