This is the code to display query result in a table...





<?
include "connection.php";

$query="select * from contactlist";
$qr=mysql_query($query);
if($qr==false){
echo ("Query cannot be executed!<br>");
echo (mysql_error());
}
else{
?>
<table border=1>
<tr>
<td>Bil</td><td>Name</td><td>Email</td>
<td>DOB</td><td>Gender</td><td>State</td>
</tr>
<?
$color="#00CCFF";
while($rekod = mysql_fetch_array($qr)){
//alternate color for row
if ($color=="#00CCFF"){
$color="#FFCC00";
}else{
$color="#00CCFF";
}

?>
<tr bgcolor="<?=$color?>" >
<td><?=$rekod["ID"]?></td>
<td><?=$rekod["nama"]?></td>
<td><?=$rekod["email"]?></td>
<td><?=$rekod["dob"]?></td>
<td><?=$rekod["gender"]?></td>
<td><?=$rekod["state"]?></td>
</tr>
<?
}//end while
?>
</table>
<?
}//end else
?>

1 comment:

  1. Hi Nice BLog The SEO Basic Course is aimed at people who are interested in knowing about Search Engine Optimization.The online seo training will help web designers and developers to create or develop better crawlable websites and students to popularize their sites in Google, Yahoo, MSN, others Search Engines...

    ReplyDelete

Popular Posts