Hi,
I just started developing in Drupal and I am wondering how I can get the autoincrement field in MySQL.

For example, I have a table named FOOD with an autoincrement field called FOODID. After I insert a new FOOD record with db_query( "Insert into Food..." ), how can I get FOODID?

Thanks for you help!

Comments

LAST_INSERT_ID()

LAST_INSERT_ID()

mysql_insert_id()

Use function $id=mysql_insert_id(); after insert.

trungso.com - PHP programming service

Auto Increment field

In my, I need to have an field that auto increments on my form after a field in the form has been updated, such as if case has been postpone, we need to know how many times the case has been posteponed,
what are your suggestions for getting this objective.

This is my Signature, Whats yours

nobody click here