Jump to content

Posting to MySQL, then getting the row number?


dagnasty

Recommended Posts

I'm making a poll system, but am confused by one thing.

Consider:
2 seperate polls can have the same poll name in the mysql database.

If after a user creates a poll, how do I go about getting the poll mysql id (auto incrementing) after the poll is created through a form. When post a new row the a mysql database, is there a way to find out it's location if it has auto incrementing id field?

For instance, if a user creates the poll and is taken to a "thanks for posting your poll. Here is a link to it"
Link to comment
Share on other sites

[quote author=dagnasty link=topic=102476.msg406700#msg406700 date=1154374597]
Ahh i see it's put right after the query. I was thinking it called from the next page.
[/quote]
Yup. if you call it on the next page it might be another one. as long as you don't close the connection or perform another insert on the same page it will be the last id from the current connection.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.