Posted By

jrobinsonc on 02/15/10


Tagged

php tables


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

joacoleo


Colorear filas de una tabla par/impar con PHP


 / Published in: PHP
 

  1. $i = 0;
  2.  
  3. foreach($rows as $row) {
  4. $class = ($i++ & 1) == 1 ? 'odd' : 'even';
  5.  
  6. echo '<tr>';
  7. echo "<td class=\"{$class}\">{$row['name']}</td>";
  8. echo "<td class=\"{$class}\">{$row['phone']}</td>";
  9. echo '</tr>';
  10.  
  11. }

Report this snippet  

You need to login to post a comment.