嗨,我試圖在雲9 執行以下代碼:MySQL表雲不顯示HTML表格9
<!DOCTYPE html>
<html lang="en">
<head>
<title>Test | Products</title>
</head>
<body>
<?php
$con=mysqli_connect(0.0.0.0,"ritikasahay","","trydb");
if (mysqli_connect_errno()) {
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM veg");
echo "<table border='1'>
<tr>
<th>Name</th>
<th>Price</th>
<th>Image</th>
</tr>";
while($row = mysqli_fetch_array($result)) {
echo "<tr>";
echo "<td>" . $row['name'] . "</td>";
echo "<td>" . $row['price'] . "</td>";
echo "<td>" . $row['image'] . "</td>";
echo "</tr>";
}
echo "</table>";
mysqli_close($con);
?>
</body>
</html>
當我執行這個代碼,我想起來了下面的PHP代碼結果而不是表格內容:
Name Price Image "; while($row = mysqli_fetch_array($result)) { echo ""; echo "" . $row['name'] . ""; echo "" . $row['price'] . ""; echo "" . $row['image'] . ""; echo ""; } echo ""; mysqli_close($con); ?>
有人可以告訴我,我錯了嗎?
不該文件具有'.php'延伸? – 2014-09-23 07:28:54