使用示例我發現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