10
I have two tables: destinations and input:
- On the table destinations: id_destination(AI) and destination;
- On the table entree: id(AI), id_destination(relation with table id_destination destinations).
I created a query to insert the first form field (destination) in the table destinations
$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 the data in the table entree:
$sqlinsert2 = mysql_query("INSERT INTO `entrada_pt` VALUES('', '$another_id')");
Only when checking the table entree, nothing is inserted, other than the table destinations, which is filled.
How to take the id of the first table and insert it into the second table?
Welcome to [en.so] and congratulations for asking at first a well formatted question, well explained and with the relevant code! Note that you walked lurkando :)
– brasofilo