PDA

View Full Version : How to get the variable from an auto_increment field


Lesane
13 Feb 2002, 11:17
Edit:
Found it already :)

mysql_insert_id()

Chen
13 Feb 2002, 13:47
$DB_site->insert_id() with vB's class. :)

Lesane
13 Feb 2002, 14:06
Thanks :up:

Is there a big difference between:

mysql_insert_id() and LAST_INSERT_ID()?

Chen
13 Feb 2002, 14:09
A bit. Use LAST_INSERT_ID() in PHP and you will get shout at by the headmaster. ;)

LAST_INSERT_ID() is a MySQL function, to be used within queries. mysql_insert_id() is a PHP function, to be used inside scripts.

But basically they both return the same thing. :)

Lesane
13 Feb 2002, 14:56
hehe aight, i will gonna use mysql_insert_id() since its a php function ;):)