带有MySQL查询的空白HTML页面

时间:2012-10-26 20:14:46

标签: php mysql

有谁知道为什么这段代码不起作用=

<html>
<head>
<title>Retrieve data from database </title>
</head>
<body>

<?php
include('connection.php');  

$sqlget = "SELECT navcode FROM nav";
$sqldata = mysqli_query($dbcon, $sqlget) or die ('error gettting request');

echo "<table>";
echo "<tr><th>navcode</th></tr></table>";

while($row = mysqli_fetch_arrary($sqldata, MYSQLI_ASSOC)) {
    echo "<tr><td>";
    echo $row['navcode'];
    echo "</td></tr>";}
echo "</table>";        
?>
</body>
</html>  

我的数据库有数据,但查询页面显示为空白。我错过了什么吗?

1 个答案:

答案 0 :(得分:2)

看起来你拼错了mysqli_fetch_array ...

while($row = mysqli_fetch_array($sqldata, MYSQLI_ASSOC)) {

而不是

while($row = mysqli_fetch_arrary($sqldata, MYSQLI_ASSOC)) {