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 include a conditional in my mysql query?What is the correct way to connect to a MySQL database?
how do i upload an image to database?
How do I find the longest value in my mysql table?
What is difference between mysql_fetch_array and mysql_fetch_object?
