nec9716 Posted March 25, 2008 Share Posted March 25, 2008 i think be bale to write in 2 table ....but how that data will be related between them that something I can't understand.... maybe someone can try to explain me.... thank you Link to comment https://forums.phpfreaks.com/topic/97806-write-in-2-table/ Share on other sites More sharing options...
BlueSkyIS Posted March 25, 2008 Share Posted March 25, 2008 table 1 has a row, id. store id in table 2 to tie table 2 to table 1 Link to comment https://forums.phpfreaks.com/topic/97806-write-in-2-table/#findComment-500392 Share on other sites More sharing options...
nec9716 Posted March 25, 2008 Author Share Posted March 25, 2008 when you say tie ...do i have to that in mysql? or by request in pa php page? Link to comment https://forums.phpfreaks.com/topic/97806-write-in-2-table/#findComment-500397 Share on other sites More sharing options...
BlueSkyIS Posted March 25, 2008 Share Posted March 25, 2008 yes. after you insert a record into table 1, you can use $insert_id = mysql_insert_id() to get the id for that record. then when you add the associated record to table 2, you include the $insert_id of record 1 table_1 id item_name table_2 id table1_id <-- use the id of table_1 here to associate this record with the record in table_1 item_color this is a 'relation' and is the basis for 'relational databases' like MySQL http://www.databasejournal.com/sqletc/article.php/1469521 Link to comment https://forums.phpfreaks.com/topic/97806-write-in-2-table/#findComment-500400 Share on other sites More sharing options...
nec9716 Posted March 25, 2008 Author Share Posted March 25, 2008 relation ....that what i have to look for ...ok I will do some test today .... thank you Link to comment https://forums.phpfreaks.com/topic/97806-write-in-2-table/#findComment-500403 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.