Having SQL join problems!
I have got a master recordset and this is the SQL for it:
SELECT fld_contentID, fld_contentPAGE, fld_contentIMGSLDR, fld_contentTITLE, fld_contentTOP, fld_contentPODL, fld_contentPODR, fld_contentBOTTOM, fld_contentBGIMG, fld_contentSHOW, fld_contentDATE
FROM tbl_content
WHERE fld_contentPAGE = '1'
ORDER BY fld_contentDATE DESC
This works fine. I can populate the page with the content that I want.
I have a second table with secondary information within it for promotional needs. This table serves what I am referring to as 'pods' of info. I am trying to pull and join content from the table called tbl_pods using the unique ID of the pod record and joining it with a field in the tbl_content table, and that field is called fld_contentPODL. Here's the code:
SELECT *
FROM tbl_pods
JOIN tbl_content ON tbl_content.fld_contentPODR = tbl_pods.fld_podID
WHERE fld_podID = podrvar
Name: podrvar
Type: Interger
Default value: %
Run-time Value: $_GET['tbl_content.fld_contentPODL']
I have tried every variation of JOIN that I can think of, but it just won't work with a dynamic default value. If I give a specific default value of 1, instead of %, then it works as expected, but only by being specific which means it's not loading the variable dynamically.
Can somebody please highlight the problem with my join statement, cos this is driving me mental!
Is there something wrong with my master table tbl_contents. I can't see that there is as I am using the field fld_contentPODL to hold the unique ID of the pod, so surely I can join the tables on that! Am I passing data incorrectly? I didn't think I was as I am asking to join the data of tbl_pods to the data of tbl_contentPODL, which should work.
Thanks in advance.
Mat
