20150316 - 原始檔 20150316 - 原始檔

<html>

<head><title>查詢資料表的記錄資料</title></head>
<body>
<table border=1>
<?

$i=0;
$link = mysqli_connect("localhost","10079533",
"10079533","10079533");

$sql = "SELECT * FROM jqm_products";

if ( $result = mysqli_query($link, $sql) ) {

while( $row = mysqli_fetch_assoc($result) ){
if ($i==0) {
echo "<td bgcolor=#ffff00>".$row["name"]."</td>". "<td bgcolor=#ffff00>".$row["price"]."</td>"."<tr>";
$i=1;
} else {
echo "<td bgcolor=#ff00ff>".$row["name"]."</td>". "<td bgcolor=#ff00ff>".$row["price"]."</td>"."<tr>";
$i=0;
}
}

mysqli_free_result($result);
}
mysqli_close($link);
?>
</table>
</body>
</html>