Page 1 of 1

MySql tables and php

Posted: Thu Feb 12, 2004 3:13 pm
by SQHell
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.

Posted: Thu Feb 12, 2004 4:37 pm
by DuFF
PHP.net wrote: mysql_insert_id -- Get the ID generated from the previous INSERT operation
Just insert to the main database first, use mysql_insert_id and then query the other 2.