Home » Demos » Show different colored rows inside a mysql result set

Show different colored rows inside a mysql result set

This example shows alternative colored rows (div element). I used different CSS pseudo classes to have different background and text colors. I added also some javascript events to create a "hover" effect for the whole "p" element. The magic is the comparison using the modulus (%) operator which decides what pseudo class is used inside the currrent row of the MySQL result set.

HotScripts.com
HotScripts.com is an Internet directory that compiles and distributes Web programming-related resources, geared toward webmasters, developers and programmers looking for enhancing their Web sites and intranets with dynamic development tools.
PHP Classes Repository
A place to find PHP classes and also complete applications. All provided information is about object oriented programming.
Premium Shopping Cart Templates
Get your online business up and running quickly with one of our professional osCommerce, Zen-Cart, CRE Loaded or eCommerce templates.
The Designers Website
Learn on this website how to build a website with your domain name, web hosting account, website template...

Related PHP functions:

mysql_query | mysql_fetch_object | mysql_free_result

Click here for the PHP script: Alternative colored rows