MySql tables and php

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
SQHell
Forum Newbie
Posts: 1
Joined: Thu Feb 12, 2004 3:13 pm

MySql tables and php

Post 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.
User avatar
DuFF
Forum Contributor
Posts: 495
Joined: Tue Jun 24, 2003 7:49 pm
Location: USA

Post 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.
Post Reply