Inserting a value into a database with an auto incrementing field is quite common. Once you insert the new row you would expect that you need to do another query to get the newly created ID.
Another option is to use the mysql_insert_id() function to retrieve the ID created by the last insert statement.
// insert $sql = 'INSERT INTO table(colum1, colum2) VALUES(1, 2);'; mysql_query($sql); // get new id $id = mysql_insert_id();
The $id variable will now contain your most recently inserted ID.