Someone recently suggested to to find the value of an autoincremented field I should "call mysql_insert_id() immediately after performing the insert". Another person told me this is a function and my code as such won't work.
Can someone elaborate on this?
See the last few lines of code to find the autoincremented variable that is assigned a value as a result of the sqlinsert insert query. Is mysql_insert_id a function (don't know much about how to handle functions yet so if it is please elaborate). Am I specifying the call correctly? Are there any other lines of code I need to add for this to work?
$sqlinsert = "insert into table (fields)
values
('$variablenames', etc.);
$return = mysql_query($sqlinsert,$myconnection) or die ("error message.");
$idtest = mysql_insert_id()
/ IS THE FOLLOWING LINE OF CODE Or OTHER LINES OF CODE NEEDED? /
/ $idtestresult = mysql_query($idtest,$myconnection) or die ("error message."); /