|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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 PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Dec 30 08:00:01 2025 UTC |
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.