Here's a question for the pros - let's say I have a MySQL table that had a unique int for the primary key that is auto_increment. Whenever a row gets inserted, I want to get the unique ID for that specific row. This is for a click tracking program I'm building, each time somebody clicks something the code fires and I need to get the unique ID that get's inserted. So we get something like this: 1) Page Loads and fires the tracking script 2) Tracking script inserts a row into the table 3) Tracking script needs the unique ID for the row How do I get the unique ID? Is there some setting in the insert query where it will return the ID?
after the script inserts the new row, use $row_id = mysql_insert_id(); Code (markup): That should give you the ID of the last row inserted ca3.php.net/mysql_insert_id
Jeebus I can't believe I've not heard of that one before. That makes things way easier lol, thanks dude