Jump to content

[SOLVED] Retrieve MySQL row's auto-increment in query


zebaron

Recommended Posts

Hi, I've only been working with PHP and MySQL for about the last month and half and have done fairly well but have run into a problem that I hope has an answer.

 

I'm working on a simple, small animation showcase site where people I know (animators) can post their animations/movies. Visitors can then "tag" their movies with descriptive words.

 

If I submit a form to insert the mysql row that has an auto-incrementing ID # on it into a table, is there a way to retrieve that ID immediately and use it in that same query to insert the ID # into another table (which I use to cross-reference the table that contains all of my movies's info and the table that contains the information I want to be able to relate to that user)?

 

SO, more plainly I want to:

- Retrieve from a form/page the movieID and tag

- Insert "tag" into "tags" table of my database, which automatically assigns each tag row an ID

- Pull the tagID for the tag row that was just created from the tags table <- Where I need the help

- Insert the tagID and movieID into a crossref table

 

Any help would be great. :D

 

 

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.