Jump to content

Using two queries in a dynamically created table.


beanfair

Recommended Posts

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,

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.