0

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

<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>  

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

4

1 回答 1

2

Looks like you mispelled mysqli_fetch_array...

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

instead of

while($row = mysqli_fetch_arrary($sqldata, MYSQLI_ASSOC)) {
于 2012-10-26T20:17:41.543 回答