地獄有 當我嘗試連接到拉東西了數據庫,會出現以下錯誤:警告:mysql_fetch_object():提供的參數不是一個有效的MySQL結果資源
Warning: mysql_fetch_object(): supplied argument is not a valid MySQL result resource in /home/content/49/5548763/html/matt/download.php on line 17
其他的無在這個網站上的答案工作。
這裏是腳本:
<?php
$con = mysql_connect("XXXX", "name", "password");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
$db_selected = mysql_select_db("nameofdb",$con);
$musictable = "";
$sql = "GET * FROM matt";
$result = mysql_query($sql,$con);
while($row = mysql_fetch_object($result)) {
$id = $row->id;
$name = $row->name;
$update = $row->update;
$length = $row->length;
$size = $row->size;
$musictable .= "
<tr>
<td width=\"63%\">".$name."</td>
<td width=\"10%\">".$length."/".$size."</td>
<td width=\"10%\"><a href=\"download.php?mp3=".$name."\">DOWLOAD</a></td>
<td width=\"17%\">|||||</td>
</tr>
";
}
?>
在while循環之前添加此代碼:var_dump($ result);併發布在這裏 – thomaux 2010-10-13 11:29:29
可能重複的[mysql_fetch_assoc():提供的參數不是在PHP有效的MySQL結果資源](http://stackoverflow.com/questions/1858304/mysql-fetch-assoc-supplied-argument-is- not-a-valid-mysql-result-resource-in-ph) – 2011-09-16 17:50:18
[Warning:mysql_fetch_ *期望參數1是資源,布爾給定錯誤](http://stackoverflow.com/questions/11674312/warning -mysql-fetch-expects-parameter-1-to-resource-boolean-given-error) – 2012-07-31 02:18:09