|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
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
|
|||
|
|||
|
Multiple Table INSERTs with FKs
I want to populate several MySQL tables from a php script, two info tables and a link table that allows for a many to one relationship. I have auto_incrementing primary keys on both information tables.
Is there a better way to quickly get the link table information without having to (my current method): 1. populate both tables and include a temporary field value 2. query both tables for temporary field value 3. populate link table 4. update temporary field values. Thanks |
|
#2
|
|||
|
|||
|
RE: Multiple Table INSERTs with FKs
What's the point of the temporary field value?
|
|
#3
|
|||
|
|||
|
RE: Multiple Table INSERTs with FKs
if i am setting up a many to many relationship, then i need some way to identify the row until i can query it and get the primary key.
I have been looking around and I think a better method is to use the mysql_insert_id() function and retrive the id after i persist the record, then use them to populate a link table. |
|
#4
|
|||
|
|||
|
RE: Multiple Table INSERTs with FKs
Yes, using mysql_insert_id would definately be a better method....
|
![]() |
| Viewing: Codewalkers Forums > Other Technologies > Database Help > Multiple Table INSERTs with FKs |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|
|
|