Wednesday, December 10, 2008

Getting Last generated auto increment value in mysql

Some tables have auto increment field.

after executing a insert command in mysql, sometimes we may want to know the last added value.... for that we can use
mysql_insert_id()
function

eg:
mysql_query($sql3); //executing some query
$last_num = mysql_insert_id(); //last added value


Cheers!

No comments: