whynot Posted January 29, 2012 Share Posted January 29, 2012 Hi, I have This Function For Two backgrounds row of table : function background() { $bg = ''; // odd $bg2 = 'F3F3F3'; // even if ( $i%2 == 0 ) $bgs = "$bg"; else $bgs = "$bg2"; return $bgs; } PHP CODE IS : echo "<TABLE>"; $i = 0; while ($f = $db->fetcharray( $r )) // for fetch { background(); // function echo "<tr> <td bgcolor=\"{$bgs}\">$id</td> <td bgcolor=\"{$bgs}\">$name</td> <td bgcolor=\"{$bgs}\">$date</td> </tr> "; $i++; } echo "</table>"; But This Not Worked. What's Problem ? Thanks Quote Link to comment Share on other sites More sharing options...
dbm Posted January 29, 2012 Share Posted January 29, 2012 I don't see where you assign the background function so try something like echo "<TABLE>"; $i = 0; while ($f = $db->fetcharray( $r )) // for fetch { $bgs = background(); // function echo "<tr> <td bgcolor=\"{$bgs}\">$id</td> <td bgcolor=\"{$bgs}\">$name</td> <td bgcolor=\"{$bgs}\">$date</td> </tr> "; $i++; } echo "</table>"; Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.