【发布时间】:2015-06-19 15:46:55
【问题描述】:
我对此有疑问...我一直在 XAMPP 中执行此操作,但没有出现任何问题..但每当我将其上传到主机时,它总是会显示此内容。
致命错误:在第 49 行的 /home/u161146050/public_html/application/views/test1.php 中的非对象上调用成员函数 fetch_assoc()。
我不知道它为什么会出现在line 49 中,但是在我在localhost 中进行操作期间,它没有出现。
<table class="table table-condensed table-hover">
<tr>
<td class="warning" id="bold">Book Id</td>
<td class="danger" id="bold">Book Title</td>
<td class="warning" id="bold">Author</td>
<td class="danger" id="bold">Status</td>
<td class="warning" id="bold">Borrower</td>
<td class="danger" id="bold">options</td>
</tr>
<?php
include('inc/config.php');
$sql = "SELECT * FROM books";
$result = $link->query($sql);
while($row = $result->fetch_assoc()) {
?>
<tr>
<td class="warning"><?php echo $row['bookNumber']?></td>
<td class="danger"><?php echo $row['title']?></td>
<td class="warning"><?php echo $row['author']?></td>
<td class="danger"><?php echo $row['status']?></td>
<td class="warning"><?php echo $row['borrower']?></td>
<td class="danger"><form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>"><div class="btn-toolbar" role="toolbar" aria-label="...">
<div class="btn-group" role="group" aria-label="...">
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-bookmark" aria-hidden="true"></span></button></a>
<button type="submit" class="btn btn-default"><span class="glyphicon glyphicon-eye-open" aria-hidden="true"></span></button></a>
</div>
</div>
</form>
</td>
</tr>
<?php }
?>
任何帮助将不胜感激。
【问题讨论】:
-
老兄,像 print_r($result) 一样调试你的结果
-
显示你的 include('inc/config.php') 文件
标签: javascript php html css xampp