Ok so my SQL query is:
$image_results = $wpdb->get_results('SELECT * FROM uploaded_images GROUP BY album_title') ;
What I now want to do is have a different set of results for each different *album_title* that outputs the album title in a tag and then show a list of items that have that album title.
Here is what i have so far:
<?php foreach ($image_results as $result => $coll):?>
<h4><?php echo $coll->album_title;?></h4>
<?php foreach ( $coll->file_name as $i => $row ) : ?>
<p><img src="http://example.com/<?php echo $row->file_name; ?>"/></p>
<?php endforeach; ?>
<?php endforeach; ?>
After your question update, I think this is what you are looking for. Note that I have used
ORDER BYinstead ofGROUP BY. Grouping is used when things likeSUM,AVG, or other aggregate functions are used. This can be handled all in one loop: