Page 1 of 1

How can I redirect to a record once it has been inserted?

Posted: Tue Jul 22, 2008 9:16 am
by Eiolon
I can't seem to find a way to do this because the record ID has not been created until it has been inserted. I could use a session but then how would I store the record ID in the session if it hasn't been created yet?

Thanks for your thoughts.

EDIT: I am trying to accomplished what this forum just did. I created a new post, it gave me a confirmation page and then redirected me to this post.

Re: How can I redirect to a record once it has been inserted?

Posted: Tue Jul 22, 2008 9:23 am
by Reviresco
You want mysql_insert_id:

http://us.php.net/mysql_insert_id

Re: How can I redirect to a record once it has been inserted?

Posted: Tue Jul 22, 2008 9:24 am
by Eiolon
Awesome, exactly what I needed!