RE: [PHP] mysql_insert_id()

From: Date: Wed, 24 Jan 2001 21:07:18 +0000
Subject: RE: [PHP] mysql_insert_id()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-36475@lists.php.net to get a copy of this message
When you are using mysql_insert_id, you don't want to pass it the result of your previous SQL statement as in: $result = mysql"mydb", "My SQL statement", $my_connect) ; $last_id = mysql_insert_id($result) Rather, you want to pass it the link identifier from your mysql_connect like: $result = mysql("mydb", "My SQL statement", $my_connect) ; $last_id = mysql_insert_id($my_connect) HTH Sam Masiello Systems Analyst Chek.Com (716) 853-1362 x289 smasiello@chekinc.com -----Original Message----- From: Boget, Chris [mailto:Chris.Boget@wild.net] Sent: Wednesday, January 24, 2001 3:50 PM To: Php (E-mail) Subject: [PHP] mysql_insert_id() I'm having intermittent problems with this function. Most of the time, it returns the proper value. However, sometimes it doesn't return anything at all even when the insert query executes without error and I can see the new data in the database. I try to get the last insert id both by supplying the link-resource and not but still get the same results. When I echo out the link-resource (what mysql() returns), all I'm gettins is a numerical one (1). What gives? Chris

« previous php.general (#36475) next »