Here's a bit of code to automatically number rows in a table and also colour the back ground of each row
Of course it's much easier if your data is in an array because the table can be created using a loop.
Code:
<?php $count=1;?> <table> <!-- add the three following lines to the start of each new row--> <tr style='background-color:<?php echo ($count%2==0)?"#afa":"aaf"; ?>'> <td><?php echo $count++;?></td> <!-- add the date--> <td >Data</td> <td>Data</td> </tr> ... </table>
Of course it's much easier if your data is in an array because the table can be created using a loop.
Comment