php - How can I generate different color lines for each row added on a table generated from SQL? -


as code generates every line same color, how can make add darker shade every other line?

i.e.: white beige white beige white beige

so becomes more readable format.

code below:

if(mysql_num_rows($result) > 0){     while($row = mysql_fetch_array($result)){         $invoiceitemssql = mysql_query('select * tblinvoiceitems invoiceid = '.$row['id'].' limit 0,1');         $invoiceitems = mysql_fetch_array($invoiceitemssql);         $html .= '<tr>             <td><a href="invoices.php?action=edit&id='.$row['id'].'">'.$row['id'].'</a></td>             <td>'.$row['firstname'].'</td>             <td>'.$row['lastname'].'</td>             <td>'.$row['companyname'].'</td>             <td>'.$row['city'].'</td>             <td>'.$row['phonenumber'].'</td>             <td>'.$row['date'].'</td>             <td>'.$row['duedate'].'</td>             <td>'.$row['total'].'</td>             <td>'.$invoiceitems['description'].'</td>         </tr>';     } } 

like so

$i = 0;  if(mysql_num_rows($result) > 0){     while($row = mysql_fetch_array($result)){      if ($i % 2 == 0) {         color white     } else {         color beige     }      $i++;     } } 

Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

c++ - Clear the memory after returning a vector in a function -

erlang - Saving a digraph to mnesia is hindered because of its side-effects -