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
[EMAIL PROTECTED]

 -----Original Message-----
From:   Boget, Chris [mailto:[EMAIL PROTECTED]]
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


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to