Re: Two color rows in table inside while iteration

From: Date: Wed, 28 Apr 2010 13:58:15 +0000
Subject: Re: Two color rows in table inside while iteration
References: 1 2 3 4 5  Groups: php.general 
Request: Send a blank email to php-general+get-304730@lists.php.net to get a copy of this message
2010/4/28 Fernando <fernando@ggtours.ca>: > What about this: > > $color = "even"; > while ($row = while condition )) { >       $color = ($color == "even") ? "odd" : "even"; >       echo ("<tr class=\"$color\">"); >       echo "<td>$row[0]</td><td>$row[1]</td> >  <td>$row[2]</td><td>$row[3]</td><td>$row[4]</td> >  "; >       echo ("</tr>") > } > > And have two classes in your style sheet that format each row differently.. > > Hope this helps. Thanks to all guys!. Now it's working perfectly as I wanted. Also was interesting to read the points you showed about JS and PHP. Best, Juan

« previous php.general (#304730) next »