|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Linking tables?
If I had a table containing a list of usernames and another few tables where each line in the table included one of the names and some other information (1 to 1 relationship).
How do I set up the mySQL tables to insert a new row into each of the other tables (containing the default data) when a new name is added to the initial table? ie. tblName (USERNAME, firstName, surName) tblSecurity (USERNAME, password) tblSex (USERNAME, sex) >> I want it so when you insert a new entry in tblName it inserts (automatically) an entry in tblSecurity containing the username and default password and an entry in tblSex containing the username and default sex. |
|
#2
|
|||
|
|||
|
RE: Linking tables?
I find it safest to do three seperate inserts, using the same username in each insert for example
insert tbl_1 (field1,field2) values ('bob','somedata') (execute the query) insert into tbl_2 (field1,field2) values ('bob','somedata') (execute the second query) insert into tbl_3 (field1,field2) values ('bob','somedata') (execute the third query) hope that helps!!! |
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Linking tables? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|