I am trying to start a database with a tagging system that consists of two tables: Q&A: A table with: ID, Questions & Answers. Tags: A table with: ID & Tags. Both tables share a common ID. In phpMyAdmin, I set up the 'Q&A' table with the ID set to auto-increment, so that I can reference each record with a unique ID. The IDs in the 'Tags' table are not unique because each IDs can have multiple words (tags) associated with it. I wrote some records to the Q&A database without any problem. But now I am stuck on how to get the unique ID (as the unique ID is being automatically created) in the Q&A table, so that that ID can be used for some number of records in the tags table.
Works. If anyone is curious... $con = mysql_connect("***","***","***"); ... $sql="INSERT INTO lessons (question, answer, html, tags) VALUES ('$question', '$answer', '$html', '$tags')"; ... echo "<h1>" . mysql_insert_id($con) . "</h1>"; PHP: The last line prints the last auto-increment value from the table that was just inserted. (mysql_insert_id knows which column is auto-incremented.)