How do i change the html element dynamically while iterating from database

slimshady

New Member
I am using a table to iterate the data from the database in a table. my html code is\[code\] <table id="tablesorter"> <thead> <tr> <th>Name</th> <th>Location</th> <th>Email</th> <th>Phone</th> </tr> </thead> <tbody> <tr> <td>Your Name</td> <td>Somewhere</td> <td>[email protected]</td> <td>9999999999</td> </tr> <tr class="trow"> <td>Your Name</td> <td>Somewhere</td> <td>[email protected]</td> <td>9999999999</td> </tr> </tbody> </table>\[/code\]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. what would be the logic behind this using with while loop?
 
Back
Top