Thread: Mysql 2 post
View Single Post
Old 11-02-2009, 10:21 AM   #2 (permalink)
sde
Moderator
 
sde's Avatar
 
Join Date: May 2002
Location: us.ca
Posts: 4,706
sde is on a distinguished road
PHP Code:
<?php
// initialize your iterator
$i=0;

// loop through result set
while ($row db_fetch_array($result)) {

  
// use the modulus operator to get the remainder of the iterator divided by 2
  // even numbers will always have a remainder of 0 when divided by 2
  
$class $i%2==0?'even':'odd';

  
// echo your div with your new class
  
echo '<div class="'$class .'">'$row['show_date'] .'</div>';

  
// increment your iterator
  
$i++;
}
?>
__________________
Mike
sde is offline   Reply With Quote