It is great to have an auto_increment field in a database, but once you insert a row in this database and somehow need the created id, things get complicated. I have many times written a query to fetch the row and get the id. However, in mysql / php there is a very useful trick to solve this problem.... it is called