xwishmasterx Posted April 3, 2011 Share Posted April 3, 2011 I am trying to create a little code, and need to get info from more than one table, preferable like so: $query = "SELECT xxx FROM xxx WHERE xxx="xxx" .......... then do stuff here. $query = "SELECT yyy FROM yyy WHERE yyy="yyy" .......... how to do this the right way? Link to comment https://forums.phpfreaks.com/topic/232580-query-on-several-tables-how-to-do-this/ Share on other sites More sharing options...
gristoi Posted April 3, 2011 Share Posted April 3, 2011 Use the JOIN statement in mysql .: SELECT x.field1, y.field1 from tablex x JOIN tabley y ON x.fieldname = y.fieldname WHERE X.fieldname2 = something Link to comment https://forums.phpfreaks.com/topic/232580-query-on-several-tables-how-to-do-this/#findComment-1196321 Share on other sites More sharing options...
xwishmasterx Posted April 3, 2011 Author Share Posted April 3, 2011 ty! worked Link to comment https://forums.phpfreaks.com/topic/232580-query-on-several-tables-how-to-do-this/#findComment-1196333 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.