Bjom, thanks for your detailed replies, but they are going over my head a little. Thanks to you I am making progress, but just need a shove in the right direction.
This is the code I have finalised with, but it is not pulling the data from the product_downloads table.
This looks pretty correct to me:
$query = "
SELECT p.*, FLOOR(prodratingtotal/prodnumratings) AS prodavgrating, imageisthumb, imagefile, ".GetProdCustomerGroupPriceSQL()."
FROM [|PREFIX|]products p
LEFT JOIN [|PREFIX|]product_downloads dn ON p.productid=dn.downloadid
LEFT JOIN [|PREFIX|]product_images pi ON p.productid=pi.imageprodid
WHERE p.prodvisible='1' AND (imageisthumb=1 OR ISNULL(imageisthumb))
".GetProdCustomerGroupPermissionsSQL()."
ORDER BY proddateadded DESC
";
Error here:
$GLOBALS['DownloadName'] = isc_html_escape($row['downname']);
downname being the field I require from TABLE [|PREFIX|]product_downloads