How to give alternating table rows different background colors using PHP

前端 未结 6 499
面向向阳花
面向向阳花 2021-01-12 07:14

I have a table of data that is generated dynamically based on the contents stored in a mysql database.

This is how my code looks:

6条回答
  •  伪装坚强ぢ
    2021-01-12 07:29

    Here is my working part ! `

     $i=1;
     while($row = mysqli_fetch_array($result)) {
     if($i%2==0)
     {
         echo '
'; } else { echo ''; } $i++; echo ""; echo ""; echo ""; } echo "
" . $row['blah'] . "" . $row['blah_blah'] . "
";

`

提交回复
热议问题