Q:

php every sixth row add class

I have a mysql query which selects 18 items from the table, but I'd like it to add a class on every 6th item.
Here's my code:
  $i = 0;
  foreach ($this->Items as $item) {

    if ($item->image) { 

            echo '<div class="storeImages"> <img src="/images/store/'.$item->image.'" width="113" height="153" border="0" alt="'.$item->name.'" title="'.$item->name.'" /> </div>';

    };

 $i++;
 };

I've tried a couple of different things, but can't seem to get it working, basically on each 6th item, I want to add style="margin-right: 0px;" :)

A:

if($i % 6 == 0){
    //add class
}

Take a look at the arithmetic operators in the manual.

