title: How do I alternate DIV colors in a while loop?
body: <p>Let's say I have a code that looks like this:</p>
  
  <pre><code>while ($info = mysql_fetch_assoc($data_p)) {
      $name = stripslashes($info['name']);
      $desc = stripslashes($info['description']);
      $desc = substr($desc, 0, 150);
      $price = stripslashes($info['price']);
      Print "&lt;div style=\"width:600px; height:150px; border:1px solid black; overflow:hidden\"&gt;&lt;div style=\"height:148px; width:25%; border:1px solid red; float:left\"&gt;&lt;center&gt;&lt;img src=\"".$picture."\" height=\"120\" width=\"120\" style=\"margin-top:15px\" /&gt;&lt;/center&gt;&lt;/div&gt;&lt;div style=\"height:150px; width:50%; border:1px solid blue; float:left; text-overflow: ellipsis; padding-top:5px\"&gt;&lt;center&gt;&lt;font size=\"+1\"&gt;&lt;b&gt;&lt;a href=\"result.php?product=".urlencode($name)."\"&gt;".$name."&lt;/b&gt;&lt;/a&gt;&lt;/font&gt;&lt;br&gt;&lt;br&gt;".$desc."...&lt;/center&gt;&lt;/div&gt;&lt;div style=\"height:150px; width:24%; border:1px solid green; float:left\"&gt;&lt;center&gt;&lt;h1&gt;$".$price."&lt;/h1&gt;&lt;button&gt;Add to Cart&lt;/button&gt;&lt;/center&gt;&lt;/div&gt;&lt;/div&gt;";
  </code></pre>
  
  <p>The main DIV that is first defined in the while loop I would like to alternate two shades of grey. So in the results it would look like light dark light dark etc...I've tried simply repeating the echos again with a different color but that makes duplicates of each result.  Is there a way to do this?</p>