RE: [PHP] inserting data to mutliple mysql tables

From: Date: Mon, 13 May 2002 06:51:42 +0000
Subject: RE: [PHP] inserting data to mutliple mysql tables
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-97302@lists.php.net to get a copy of this message
You have to do separate inserts...you can't JOIN inserts like that... ---John Holmes... > -----Original Message----- > From: Peter [mailto:php@vfsa.com.au] > Sent: Sunday, May 12, 2002 8:38 PM > To: Php > Subject: [PHP] inserting data to mutliple mysql tables > > Hi, > > 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', > '$blah5'); > > > 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 > stored. > > 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? > > Cheers > > Peter > "the only dumb question is the one that wasn't asked" > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#97302) next »