beanfair Posted November 18, 2007 Share Posted November 18, 2007 We are working on a website that has a directory of teachers. The specs calls for a page that shows all of the teachers in a specific region. That is the easy part. The database has a main table of practitioners and another table of regions with the ID of the practitioner as the foreign key so practitioners may have multiple regions in which they teach. On a region page, we want the practitioner's picture, name and ALL regions. Getting all of the regions to show is the problem. We are thinking we would need to run another query within the table cell but really want to avoid that. SELECT sacred_ads.sacred_adsID, sacred_ads.adURL, sacred_ads.adName, sacred_ads.practType, sacred_adLabel.adLabel, sacred_ads.thumbnail, sacred_ads.adStatus, sacred_adLocations.adCity, sacred_adLocations.adState, stateRegions.region FROM sacred_ads INNER JOIN (sacred_adLabel INNER JOIN (sacred_adLocations INNER JOIN stateRegions ON stateRegions.stateRegionsID = sacred_adLocations.adState) ON sacred_adLabel.adLabelID = sacred_ads.adLabel) ON sacred_ads.sacred_adsID = sacred_adLocations.sacred_adsID WHERE sacred_ads.adStatus =2 AND stateRegions.region = [[VAL]] AND sacred_ads.practType = [[VAL]]; we use php to dynamically create and populate the table. Basically we need to the the contents of this query SELECT adCity, adState, FROM sacred_adLocations WHERE sacred_adsID = [[VAL]] to the table cell. Any suggestions are most appreciated, Quote Link to comment https://forums.phpfreaks.com/topic/77798-using-two-queries-in-a-dynamically-created-table/ Share on other sites More sharing options...
beanfair Posted November 18, 2007 Author Share Posted November 18, 2007 Sorry posted in the wrong forum Quote Link to comment https://forums.phpfreaks.com/topic/77798-using-two-queries-in-a-dynamically-created-table/#findComment-394142 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.