03-12-2008, 08:53 PM
|
#6 (permalink)
|
|
The Contributor
Join Date: Jan 2008
Location: Brazil
Posts: 77
Thanks: 14
|
From your first post it seems the photos also come from the database.
How is the data returned by your SQL query organized?
If it returns 5 rows for each artist (name repeats but the photo changes) you could do it like this:
PHP Code:
// Some helper variables
$counter = 0;
$last_name = '';
while ($row = mysql_fetch_array($reesul) {
++$counter;
// Check if we have a new name
if ($row['name'] != $last_name) {
// Yes, we have a new name so we print it
echo $row['name'], '<br />';
// And we also update $last_name to the current name.
$last_name = $row['name'];
}
// Here we print the image tag
echo '<img src="', $row['photo'], '" />';
// If we looped through 5 records it's time to print a line break (<br />)
if ($counter % 5 == 0) {
echo '<br />';
}
}
|
|
|