MYSQL_INSERT_ID() Question
Posted: Tue Apr 06, 2004 2:53 pm
Here is my code:
With mysql_insert_id() I know it is supposed to retreive the auto-increment value inserted. Am I going wrong somewhere in my code?
What I need to do is after inserting a record into the database I need to retrieve the value of the last inserted id and store it in a variable so I can use it in subsequent insert statements.
I hope this makes sense.
Any help would be appreciated.
Code: Select all
<?php
mysql_query($insertProspective);
$lastID = mysql_query("MYSQL_INSERT_ID()");
$row = mysql_fetch_array($lastID);
echo $row;
?>What I need to do is after inserting a record into the database I need to retrieve the value of the last inserted id and store it in a variable so I can use it in subsequent insert statements.
I hope this makes sense.
Any help would be appreciated.