all you need to know is
| Code: : |
mysql_insert_id();
|
this function will return the last id inserted into a table.
therefore
| Code: : |
$query = "insert into tablename(fieldname) values('$variable')";
mysql_query($query);
$previd = mysql_insert_id();
//now you have the new auto generated
//primary id created your mysqlbackend.
//you may now use that id to insert into
//your other table to keep your relation in tact
|