Page 1 of 1

How to retrieve an incremental variable as soon as it is ins

Posted: Thu Mar 31, 2011 6:29 pm
by stubarny1
Hello,

Please could someone tell me how to retrieve an incremental variable from MYSQL as soon as it is inserted? (i.e. before another variable can be inserted)

Many thanks.

Stu

Re: How to retrieve an incremental variable as soon as it is

Posted: Thu Mar 31, 2011 6:45 pm
by social_experiment
If you have an auto-increment column you can retrieve the last value (for said column) from an INSERT query by using mysql_insert_id()