I am creating a registration form for a website. When the information the user enters into the form is verified, it will be inserted into a table (tblStudent) in a MySQL db. The primary key of tblStudent is an autonumber. Is there a way to get the primary key for the user I just inserted into the db? I need to set the primary key for that user to a variable because I need to pass it along to paypal for an IPN script.
Thanks







jGirlyGirl posted this at 16:57—19th April 2007.
They have: 25 posts
Joined: Mar 2007
Yon can use mysql_insert_id right after you place the data in tblStudent.
http://us2.php.net/mysql_insert_id
$myautoid = mysql_insert_id();
teammatt3 posted this at 04:26—20th April 2007.
He has: 1,831 posts
Joined: Sep 2003
Thank you
jGirlyGirl posted this at 04:29—20th April 2007.
They have: 25 posts
Joined: Mar 2007
Anytime