Jump to content

mysql insert, find key (autoincrement) of inserted row


voodoochicken

Recommended Posts

hi, i need to find the key of the row i just added. I did not specify the row in the insert statement, since the field is set to autoincrease. the idea is something like this:$comando = "INSERT INTO DIBUJOS (DIBUJO) VALUES ('" . $_POST["dibujo"] . "')";$resultado = mysql_query($comando,$link);if ($resultado) // find key of the inserted arrow, mysql_query for insert return true or false ;else // something else ;any pointers?tnx!

Link to comment
Share on other sites

hi, i need to find the key of the row i just added. I did not specify the row in the insert statement, since the field is set to autoincrease. the idea is something like this:$comando = "INSERT INTO DIBUJOS (DIBUJO) VALUES ('" . $_POST["dibujo"] . "')";$resultado = mysql_query($comando,$link);if ($resultado) // find key of the inserted arrow, mysql_query for insert return true or false ;else // something else ;any pointers?tnx!
ok, i found about 'mysql_insert_id()'
Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...