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"
[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.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.