Page is a not externally linkable
- Code, Content, and Presentation
-- PHP Server Side Scripting
---- changing table bgcolor in a foreach loop


dreamcatcher - 12:53 am on Dec 11, 2009 (gmt 0)


You don`t need so much code CyBerAliEn, a simple ternary operator will suffice.


$i=0;
foreach($data as $key => $val){

echo "<tr>";
echo "<td bgcolor='#".(++$i%2==0 ? 'ffffff' : 'cccccc')."'>".$data[$key]['NAME']."</td>";
echo "</tr>";

}

dc


Thread source:: http://www.webmasterworld.com/php/4040996.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com