Advertisement
Guest User

djpw.cz - Odlíšenie párnych/nepárnych riadkov 2 (FAQ)

a guest
Feb 8th, 2015
311
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. echo "<ul>";
  2. $suda = false;
  3. while ($line = mysqli_fetch_assoc($result))
  4. {
  5.   $trida = $suda ? "suda" : "licha"; // stejné jako minule
  6.   $suda = !$suda; // ! neguje současnou hodnotu a negaci ukládá pro příští iteraci
  7.   echo "<li class=\"$trida\">{$line['den']}</li>";
  8. }
  9. echo "</ul>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement