Hi all,
I am having trouble selecting multiple records from one table, and their associated multiple images from another table.
So I am able to return the results, but for the records with multiple images, it returns that record multiple times, a separate record for each image.
Is there a better way i could structure my query to bring back one of each record with all its associated images? Or is there a way i can make php cycle the results to display all the images with the same record reference before moving onto the next record. This has had me stumped for a while. I think this is where my current sql knowledge halts.
Thanks for looking,
Paul.
I am having trouble selecting multiple records from one table, and their associated multiple images from another table.
Code:
$qry = "SELECT * FROM `news` LEFT JOIN images ON news.id = images.imgCategory AND images.imgSection = 'news'";
So I am able to return the results, but for the records with multiple images, it returns that record multiple times, a separate record for each image.
Is there a better way i could structure my query to bring back one of each record with all its associated images? Or is there a way i can make php cycle the results to display all the images with the same record reference before moving onto the next record. This has had me stumped for a while. I think this is where my current sql knowledge halts.
Thanks for looking,
Paul.