How do I find the ID of a new row added to a table?
Here's how you do it:
<?php
$q = mysql_query("INSERT INTO mytable VALUES('test')");
$rownumber = mysql_insert_id();
//$rownumber contains the id of the new row
?>
Comment on this Question and Answer >>>
ASK A QUESTION
More mysql PHP Questions
How do I set a default value for ENUM fields in PHP?How do I update the contents of a table row?
How do I order the results of my query?
How do I access the current time with mysql?
How do I connect to mySQL from PHP?
