If you use an auto-increment id field and you add a new record then the returned id is zero!!! Of course the new added row does not make a round trip from the database using not the new database record but the values from the form and the user has to refresh the page to see the id that just created from the database.