View Full Version : Simple Question- Retrieve Last DB Insert ID

06-16-2005, 09:19 PM

I am working on a couple of scripts that insert data into a mysql database and then sends the user off to PayPal. I am setting them us so the product ID is the same as the database ID so it works well with my IPN system. What I have done in the past is to use a Insert query followed by a Select query to get the ID. This works but I know I have seen another way to do it that was a snap but I can't find it.

If you know what I am talking about please post it. Thanks for the help!

Kid Charming
06-16-2005, 09:34 PM
You're probably thinking of mysql_insert_id() (http://us4.php.net/manual/en/function.mysql-insert-id.php).

06-16-2005, 09:42 PM
That's probably it. I'll give that a try.
Thanks for the help and the amazingly quick reply!