I like the PHP function mysql_insert_id( ) . I just found out about it. It is good for when you just inserted on one table and you want to insert the autogenerated primary key into another table. Almost serves as the equivalent of an Oracle sequence object, but not quite.
Works as follows
[ME]: Damn. I wonder how to find the user ID for the brand new user without doing another query?
[Narrator from Dukes of Hazzard]: "Well, son just try $user_id = mysql_insert_id(); "
9:01:06 PM
|