I have a form that a user can fill in details on. These details are then inserted into different tables in the database. But how can I make sure they are all linked?
There are 3 tables, 1 main table and then 2 that relate to that table.
Is there a way I can pass the id of the 2 table to fields on the main table all in 1 script.
MySql tables and php
Moderator: General Moderators
Just insert to the main database first, use mysql_insert_id and then query the other 2.PHP.net wrote: mysql_insert_id -- Get the ID generated from the previous INSERT operation