Joomla!, Wordpress tips for building your site

Joomla!, Wordpress tips for building your site

Syndicate this site using RSS

1. How to get last insert auto increment id.

If you set ‘AUTO_INCREMENT’ to attribute of the table column , its column will increment automatic when records is inserted into the table. And its increment number is unique. Moreover, I think that you often specify such information for primary key (PRIMARY KEY).

You will not consider this column information usually. However, when you want to take out inserted information, you might feel it to the necessity.

How to get last insert auto increment id?
It is easy. If you execute the following SQL, MySQL will answer last insert auto increment id.

select last_insert_id() [from table name];

Read more...

Published on| February 10th, 2010 | No Comment.