How do i change the html element dynamically while iterating from database
<p>I am using a table to iterate the data from the database in a table. my html code is</p>

<pre><code>    &lt;table id="tablesorter"&gt; 
        &lt;thead&gt; 
           &lt;tr&gt; 
           &lt;th&gt;Name&lt;/th&gt; 
           &lt;th&gt;Location&lt;/th&gt; 
           &lt;th&gt;Email&lt;/th&gt; 
           &lt;th&gt;Phone&lt;/th&gt; 
           &lt;/tr&gt; 
        &lt;/thead&gt; 
        &lt;tbody&gt; 
           &lt;tr&gt; 
           &lt;td&gt;Your Name&lt;/td&gt; 
           &lt;td&gt;Somewhere&lt;/td&gt; 
           &lt;td&gt;test@test.com&lt;/td&gt; 
           &lt;td&gt;9999999999&lt;/td&gt; 
           &lt;/tr&gt; 
        &lt;tr class="trow"&gt; 
           &lt;td&gt;Your Name&lt;/td&gt; 
           &lt;td&gt;Somewhere&lt;/td&gt; 
           &lt;td&gt;test@test.com&lt;/td&gt; 
           &lt;td&gt;9999999999&lt;/td&gt;  
           &lt;/tr&gt; 
           &lt;/tbody&gt; 
   &lt;/table&gt;
</code></pre>

<p>In my HTML table i am using a class for a table row to style it for every second table row. now while fetching the data from the database i want to make sure it does the same thing. it should add the class trow for every second table row. </p>

<p>what would be the logic behind this using with while loop?</p>
