aidan515 Posted February 15, 2010 Share Posted February 15, 2010 Hi guys, I have two tables called table1 and table2 and I have accountID in both of the tables. I want to display an image from table 2 when the id is the same as that in table 1. I think I need to use foreign keys but am not sure. Could someone please help me step by step. Thanks! Link to comment https://forums.phpfreaks.com/topic/192170-mysql-query-using-ids/ Share on other sites More sharing options...
SpankMarvin Posted February 15, 2010 Share Posted February 15, 2010 Hi guys, I have two tables called table1 and table2 and I have accountID in both of the tables. I want to display an image from table 2 when the id is the same as that in table 1. I think I need to use foreign keys but am not sure. Could someone please help me step by step. Thanks! Not sure how your tables are structured but the query would be something like "select table2.image from table1, table2 where table1.id='whatever-the-id-number-is' and table1.id=table2.id" J Link to comment https://forums.phpfreaks.com/topic/192170-mysql-query-using-ids/#findComment-1012806 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.