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 Link to comment https://forums.phpfreaks.com/topic/255969-table-background-row-using-php-function/ 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>"; Link to comment https://forums.phpfreaks.com/topic/255969-table-background-row-using-php-function/#findComment-1312141 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.