View Single Post
Old 03-12-2008, 08:53 PM   #6 (permalink)
DeMo
The Contributor
 
DeMo's Avatar
 
Join Date: Jan 2008
Location: Brazil
Posts: 77
Thanks: 14
DeMo is on a distinguished road
Default

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 == 0) {
    echo 
'<br />';
  }

Send a message via ICQ to DeMo Send a message via MSN to DeMo Send a message via Skype™ to DeMo
DeMo is offline  
Reply With Quote