Isn't this more of a database question than a PHP question?

-----Original Message-----
From: Peter [mailto:[EMAIL PROTECTED]]
Sent: Monday, May 13, 2002 1:38 PM
To: Php
Subject: [PHP] inserting data to mutliple mysql tables


I have a table that's full of references to indexs in other tables if I want
to insert a new record do I have to make a script to insert into all the
tables ie:

insert script for table 1
insert script for table 2
insert script for table 3
insert script for table 4

or can I have it all in one insert statement like you can with the SELECT
statement ie

INSERT INTO table1, table2, table3, table4 (blah, blah1, blah2, blah3,
blah4, blah5) VALUES('$blah', '$blah1', '$blah2', '$blah3', '$blah4',

and if i can do it that way how do i get the table referencing the indexes
to show the reference number rather than the actual inputted data ie: say
table1 is the reference table and table 2 is the table that matches up the
username with the real name where i want the actual full information to be

eg table 1

id userid
1 10

table 2

id username nameid
10 boo 15

table 3

id name extra fields in here
15 bob Smith

now when i add a new record I want table one to be have the new userid added
to it table 2 to have the full user name matched to their nameid inserted
and table 3 to get the full name of the person...

any ideas?


"the only dumb question is the one that wasn't asked"

PHP General Mailing List (
To unsubscribe, visit:

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to