Javascript 无法使用mysql获取响应。\u fetch\u array()预期参数1为资源

Javascript 无法使用mysql获取响应。\u fetch\u array()预期参数1为资源,javascript,Javascript,我有一个错误:警告:mysql\u fetch\u array()希望参数1是resource,布尔值在第149行的/home/xgamming/public\u html/list.php中给出 这是我在第149行的list.php文件中的代码 while($row = mysql_fetch_array($result)) { echo "<tr> <td>{$count}</td> <

我有一个错误:警告:mysql\u fetch\u array()希望参数1是resource,布尔值在第149行的/home/xgamming/public\u html/list.php中给出

这是我在第149行的
list.php
文件中的代码

    while($row = mysql_fetch_array($result))    {
        echo "<tr>

        <td>{$count}</td>
        <td><font \color=\"blue\">{$row['ip']}:{$row['port']}</b></font></td>
        <td> {$row['drops']}</td>
        <td>{$row['last']}</td>
        <td><a href=\"http://www.gametracker.com/server_info/{$row['ip']}:{$row['port']}/\" target=\"_blank\"><img src=\"http://cache.www.gametracker.com/server_info/{$row['ip']}:{$row['port']}/b_350_20_FFFFFF_FFFFFF_000000_000000.png\" border=\"0\" width=\"300\" height=\"20\" alt=\"\"/></a></td>

        </tr>";

       $count++;

     }

     echo "</table></font>";
 ?>

 </div>
while($row=mysql\u fetch\u array($result)){
回声“
{$count}
{$row['ip']}:{$row['port']}
{$row['drops']}
{$row['last']}
";
$count++;
}
回声“;
?>

我有一个MySQL数据库,空的,没有表。我怎样才能解决它

如果查询失败,则
mysql\u query
返回一个布尔值,而不是结果集指针

当您直接将结果集传递给任何
mysql\u fetch\u*
操作时,您将得到此错误

无论何时发生查询失败,您都需要自己优雅地处理

$result = mysql_query($someQuery);
if(!$result) {
    echo "An error occurred!";
    //Any more handling.
}
else {
    //Normal query processing.
}
或者,您可以使用
异常


作为旁注,请不要使用
MySQL
,因为它现在已被弃用。使用
MySQLi
PDO

我可以问一下,如果您没有要查询的表,您的预期结果会是什么吗?