I am wondering how to change this :
This code is using a table and I instead trying to use a div, but I wanna define the div the same way it's done with enter <td>. In <td class= '".$class." thum'> here
Like enter <div class='".$class." thumb'> here
enter <td ' class='".$class." thumb'><div align='center'><a href='show-".$row['id'].".php'><img src='".$row['image']."' width='80' height='60' /></a></div></td> here
I am trying to change color on each iteration of loop. That's what $class is there.
I don't think this is clear at all. It's hard to explain it
Thanks in advance
You could define a new value within each loop prior to echoing the output. For instance, if you wanted "zebra stripes," you could check if the current iteration is even or odd:
for ( $i = 0; $i < count( $items ); $i++ ) {
$style = ( $i % 2 == 0 ) ? $styleA : $styleB ;
echo "<td class='{$style} thumb'>...</td>";
}
Sample Output: http://codepad.org/8cYyiBBH