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

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Eiolon
Forum Newbie
Posts: 17
Joined: Tue Feb 14, 2006 1:42 pm

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

Post 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.
Reviresco
Forum Contributor
Posts: 172
Joined: Tue Feb 19, 2008 4:18 pm
Location: Milwaukee

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

Post by Reviresco »

You want mysql_insert_id:

http://us.php.net/mysql_insert_id
Eiolon
Forum Newbie
Posts: 17
Joined: Tue Feb 14, 2006 1:42 pm

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

Post by Eiolon »

Awesome, exactly what I needed!
Post Reply