I have two tables: destinations and entry:
- In the destinations table: dest_id (AI) and destination;
- In the entry table: id (id), target_id (relative to destination id of the destinations table)
I created a query to insert the first form field (destination) into the destinations table
$sqlinsert1 = mysql_query("INSERT INTO 'destinos' VALUES('', '$destino')");
I created a second query to fetch the newly created row:
$another_id = mysql_query("SELECT * FROM 'destinos' WHERE destino = '$destino'");
And a third query to insert data into the input table:
$sqlinsert2 = mysql_query("INSERT INTO 'entrada_pt' VALUES('', '$another_id')");
Only when checking the entry table, nothing is inserted, other than the destinations table, which is populated.
How to get the id of the first table and insert it into the second table?