使用示例我发现here我正在使用下面的代码创建一个带有PHP的表格。然而,当我运行它,我收到以下错误:MySQL到PHP的HTML表格中
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /homepages/2/d333603417/htdocs/locationsconsole.php on line 94
线的我的代码94是while (($row = mysql_fetch_assoc($query)) !== false) {
可能有人也许请告诉我,我有解释的代码错误,或者是有一个代码错误。我只是想知道是否有人可以看看这个问题,并提供一些关于如何纠正这个问题的指导。
许多的感谢和亲切的问候
<form name="locationsconsole" id="locationsconsole" method="post" action="locationsaction.php">
<?php
$query = "SELECT l.*, COUNT(f.locationid) totalfinds FROM detectinglocations l LEFT JOIN finds f ON f.locationid = l.locationid WHERE l.userid = '27' GROUP BY l.locationname";
?>
<table>
<thead>
<tr>
<th width="62"><div align="center">Location Name</div></th>
<th width="120"><div align="left">Location Address</div></th>
<th width="81"><div align="center">No. Of Finds Made </div></th>
</tr>
</thead>
<tbody>
<?php
while (($row = mysql_fetch_assoc($query)) !== false) {
?>
<tr>
<td><?php echo $row['locationname']; ?></td>
<td><?php echo $row['returnedaddress']; ?></td>
<td><?php echo $row['totalfinds']; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
</form>
什么是表1?你不应该有一个“检测位置AS 1”吗? – Sablefoste 2012-07-05 17:21:34
@SableFoste:它实际上是字母“L”。至于......'AS' ......它隐含着:) – Ryan 2012-07-05 17:23:02