php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #3162 PHP4b3 - mysql_insert_id no longer accepts an arg
Submitted: 2000-01-10 14:40 UTC Modified: 2000-07-22 19:30 UTC
From: xmtj at rims dot com Assigned:
Status: Closed Package: MySQL related
PHP Version: 3.0.13 OS: RH Linux 6.1
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: xmtj at rims dot com
New email:
PHP Version: OS:

 

 [2000-01-10 14:40 UTC] xmtj at rims dot com
$result = mysql_insert($query)
$id = mysql_insert_id($result)

This worked in PHP3. It fails in php4b3 with an error message:

PHP Warning:  Supplied argument is not a valid MySQL-Link resource in /home/httpd/html/yada.php

The solution:

$result = mysql_insert($query)
$id = mysql_insert_id()

Environment:

MySql: 3.22.27
PHP 4.03b

System: Linux rimsweb 2.2.12-20 #1 Mon Sep 27 10:25:54 EDT 1999 i586 unknown


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-07-22 19:30 UTC] mrobinso at cvs dot php dot net
mysql_insert_id() accepts the link identifier, not
the result, as the parameter.

$conn = mysql_connect("yada","yada","yada");
... insert query ...;
$id = mysql_insert_id($conn);

If the link identifier is omitted, php assumes that
last valid link.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Sun Jul 13 12:01:31 2025 UTC