CloudSex13 Posted May 10, 2009 Share Posted May 10, 2009 I have a coding problem that has stumped me for the past week: For example, let's say I have a field in a database called Container under the table Users containing the following values: 1,2,3,64,3,3,3,1 I'm trying to link those values to another table in the same database called Things where the user's Container is equal to the ThingID, and then echo all the ones that match. Could anyone offer me a bit of help in how to go about this? Thank you, if so. Link to comment https://forums.phpfreaks.com/topic/157635-associating-an-arrays-value-to-a-database-fields-value/ Share on other sites More sharing options...
michaellunsford Posted May 11, 2009 Share Posted May 11, 2009 Assuming it's mysql, this query (I made up UserID_Field, for lack of a real name) should get you close enough to figure it out. SELECT *.`Container`,*.`Things` FROM `Container`,`Things` WHERE `ThingID`.`Things` = `UserID_Field`.`Container` Link to comment https://forums.phpfreaks.com/topic/157635-associating-an-arrays-value-to-a-database-fields-value/#findComment-831287 Share on other sites More sharing options...
CloudSex13 Posted May 11, 2009 Author Share Posted May 11, 2009 Wait, you can combine SQL statements like that crossing tables? Link to comment https://forums.phpfreaks.com/topic/157635-associating-an-arrays-value-to-a-database-fields-value/#findComment-831293 Share on other sites More sharing options...
michaellunsford Posted May 11, 2009 Share Posted May 11, 2009 Yep, you can do all kinds of crazy stuff with mysql. Link to comment https://forums.phpfreaks.com/topic/157635-associating-an-arrays-value-to-a-database-fields-value/#findComment-831294 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.