List Info

Thread: note 76031 added to control-structures.alternative-syntax




note 76031 added to control-structures.alternative-syntax
user name
2007-06-27 03:59:38
3 Lines to make table row colors alternate.  Could be used
for other applications as well.

<?
//1. Initialize alternating variable.
$alt_color=true;

while($row=mysql_fetch_array($result)){
  //2. If alt var true set one color if false set the
other.
  echo (($alt_color) ? "<tr
bgcolor="#ffffff">n" : "<tr
bgcolor="#D9E5F1">n");
  echo "<td>echo
$row['id'];;</td>n";
  echo "</tr>n";
  //3. Alternate the variable value;
  (($alt_color) ? $alt_color=false : $alt_color=true);
}
?>
----
Server IP: 64.71.164.2
Probable Submitter: 72.129.215.112
----
Manual Page -- http://www.php.net/manual/en/control-struc
tures.alternative-syntax.php
Edit        -- https://master
.php.net/note/edit/76031
Del: integrated  -- h
ttps://master.php.net/note/delete/76031/integrated
Del: useless     -- http
s://master.php.net/note/delete/76031/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/76031/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/76031/spam
Del: non-english -- 
https://master.php.net/note/delete/76031/non-english
Del: in docs     -- http
s://master.php.net/note/delete/76031/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/76031
Reject      -- https://mast
er.php.net/note/reject/76031
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )