title: How to make 4 items in a row using while loop?
body: <p>I'm trying to display my products from the database. I'm trying to split it using the if 4%=0, but I can't get it to display 4 items in a row.</p>
  
  <p><strong>Here is my codes:</strong></p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;
       &lt;?php
          include "connect_to_mysql.php";
          $split = 0;
          $display_all = mysql_query("SELECT * FROM products 
              ORDER BY FIELD(category, 'ipad','iphone','others')");
          while($row=mysql_fetch_array($display_all)) {
          $id = $row['id'];
          $product_code = $row['product_code'];
          $title = $row['title'];
          $price = $row['price'];
          $split++;   
          if ($split%4==0){
          echo '&lt;/tr&gt;&lt;tr&gt;';   
          }
          ?&gt;
          &lt;td&gt;
          &lt;table class="normal_text" align="center"&gt;
          &lt;tr&gt;
          &lt;td&gt;&lt;a href="product.php?product_id=&lt;?php echo $id?&gt;"&gt;
              &lt;img width="200px" height="133px" src="products/&lt;?php echo $product_code?&gt;.jpg" /&gt;
              &lt;/a&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td align="center" style="font-weight:bold"&gt;&lt;?php echo $title;?&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;tr&gt;
          &lt;td align="center"&gt;$&lt;?php echo $price;?&gt;&lt;/td&gt;
          &lt;/tr&gt;
          &lt;/table&gt;
          &lt;/td&gt;
          &lt;?php
          }
          ?&gt;
  &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>