PHP Example
Screen shot
PHP Script to fetch record from database with alternate color row (save file as index.php)

<?php
$con=mysql_connect('localhost','root','') or die("Mysql not connect");
$database=mysql_select_db('test',$con) or die("not connected");
?>
<html>
<head>
<title>Fetch record from dataBase</title>
</head>
<body>
<?php
$query="select * from info";
$result=mysql_query($query);
?>
<table border='0'>
<tr bgcolor="#00CCCC">
<td>Username</td>
<td>Email ID</td>
<td>Country</td>
</tr>
<?php
$i=0;
while($data=mysql_fetch_array($result))
{
if($i%2==0)
{
?>
<tr bgcolor="#FF99FF">
<td><?php echo $data['username']; ?></td>
<td><?php echo $data['email_id']; ?></td>
<td><?php echo $data['country']; ?></td>
</tr>
<?php }else{ ?>
<tr bgcolor="#B4F7FA">
<td><?php echo $data['username']; ?></td>
<td><?php echo $data['email_id']; ?></td>
<td><?php echo $data['country']; ?></td>
</tr>
<?php
}
$i++;
}
?>
</table>

</body>
</html>

You can download source code here