ted_chou12 Posted December 9, 2006 Share Posted December 9, 2006 Is there any script for alternative table row coloring with css? so far i only know how to do it in php, and its quite complicated, so i think it might be easier if using css.reply to this if you dont understand what i am saying. :D Quote Link to comment Share on other sites More sharing options...
Zane Posted December 9, 2006 Share Posted December 9, 2006 http://www.somacon.com/p338.php Quote Link to comment Share on other sites More sharing options...
vai_ron Posted December 13, 2006 Share Posted December 13, 2006 i think php is better if you have so many rows, here is a simple one in phphope this helps!![code]<?php $query = "SELECT * FROM table";$result = $dbh->query($query); // output query into a tableecho "<br><br><table border=0>\n"; // fetch rows as object example if you only have 2 rows: printf ("%s, %s\n", $row->rowname1, $row->rowname2);while($row = $result->fetchRow(DB_FETCHMODE_OBJECT)){// alternate table color outputif($x%2): $color = "#eee"; else: $color = "#cecece"; endif;// output row values, rows are fetch as objectprintf("<tr><td style=\"background-color: ".$color. "\">%s</td><td style=\"background-color: ".$color."\">%s</td></tr>\n", $row->rowname1, $row->rowname2);$x++;}echo "</table>\n";?>[/code] Quote Link to comment Share on other sites More sharing options...
ted_chou12 Posted December 14, 2006 Author Share Posted December 14, 2006 thanks for sharing! :) 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.