
This tutorial will teach you how to use PHP to alternate row colors. This can be applied to any loop.
Example:
| 0 | http://www.westernstudios.net |
| 1 | http://www.westernstudios.net |
| 2 | http://www.westernstudios.net |
| 3 | http://www.westernstudios.net |
| 4 | http://www.westernstudios.net |
Steps :
1. This is a very simple bit of code but the results will be easier for the user to understand. The following codes does the trick. The key is the ($i % 2). That code is used to see if there are any remainders which will inturn determine if the number is odd or even.
As you can see we displayed the color using CSS. You can choose to display the color using the bgcolor row tag but for better coding, this method is best.
Consider buying me coffee if you find this tutorial helpful.

Marketplace Themes, scripts, icons and images
Themes site PHP Nuke themes preview site.
234
13,482