Thursday, March 17, 2011

Last inserted ID of query in MySQL

For example: You just inserted something into database with query, and you need to receive ID of the last insert. You dont need to create another selection with `id` DESC. All you need to do is just receive id with function called - mysql_insert_id().

PHP: $last_id = mysql_insert_id();

1 comment:

  1. I often try to remember how to do that.. so i wrote the article <3