Possible Duplicate:
Insert into 2 tables with PDO MySQL
Im trying to insert data into 2 tables, my problem is in 1 table i have an ID that is automatically incremented, I then want to insert into another table. At the minute as I don't know how to solve this im passing a hidden field input using rand(); and inserting that field into both queries, only sometimes the web pages may get cached and some records are being overwritten, I hope this makes sense?
$sql = "
INSERT INTO `directory` (`First_Name`,`Surname`,`Nicknames` ) VALUES (:firstname, :surname, :nicknames);
INSERT INTO `user_sightings` (`UID`, `postcode`) VALUES (:uid, :lastseenpostcode);
";