Page 1 of 1

HOW TO SAVE mysql_insert_id() value

Posted: Tue Aug 31, 2010 2:55 am
by SamiBH
Hello,

I have this: $MSG_id=mysql_insert_id();

How can I save $MSG_id value so i can use it in another query?

thank you

Re: HOW TO SAVE mysql_insert_id() value

Posted: Tue Aug 31, 2010 3:49 am
by iijb
Hi
Can you give some more details.
Also if you want to store it another query you just use that variable.

Regards
iijb

Re: HOW TO SAVE mysql_insert_id() value

Posted: Tue Aug 31, 2010 9:35 am
by timWebUK
Store it in a session.

Code: Select all

session_start();

// ... Code and queries

$_SESSION['userID'] = mysql_insert_id();