title: printing 2 columns in a table while in for loop
body: <p>I am trying to print results from a mysql query in a table that will be in 2 columns. to do this through my for loop i did the following:</p>
  
  <pre><code>    $num = 1;
              while($r = $qry-&gt;fetch())
              {
                      if (!fmod($num,2)) echo '&lt;tr&gt;';
                      echo "&lt;td&gt;" . $num . "&lt;/td&gt;";
                      if (!fmod($num,2)) echo '&lt;/tr&gt;';
                      $num++;
             }
  </code></pre>
  
  <p>however,  each row is getting its own row in the table.  even though $num is printed and shows 1,2,3,4 and so on.  what am i missing?</p>