-2

当我运行我的网页时,无论我使用哪个代码,我总是会收到此错误

Warning: mysql_fetch_array() expects parameter 1 to be resource, boolean given in /home/content/33/10729533/html/website/panel.php on line 67

这是我的代码

<?php
$connect = mysql_connect("N/A","N/A","N/A");
mysql_select_db("cdkeys");
$query = mysql_query("SELECT * FROM cdkeys WHERE = 'cdkeys'");
WHILE($rows = mysql_fetch_array($query)):

    $cdkeys = $rows['cdkeys'];

    echo "$cdkeys";

    endwhile;
?>
4

3 回答 3

0

SELECT你的语法有错误

$query = mysql_query("SELECT * FROM cdkeys WHERE = 'cdkeys'");

如您所见,您在 sintax 中错过了包含等于的字段cdkeys
请更改为

$query = mysql_query("SELECT * FROM `cdkeys` WHERE `FIELD` = 'cdkeys'");

注意:FIELD随表格的实际字段而变化

参考 这里

于 2013-04-15T10:40:55.633 回答
0

您的查询错误,where 子句中缺少列名

改变

$query = mysql_query("SELECT * FROM cdkeys WHERE = 'cdkeys'");

$query = mysql_query("SELECT * FROM cdkeys WHERE columname = 'cdkeys'");
于 2013-04-15T10:41:31.653 回答
0

改变

$query = mysql_query("SELECT * FROM cdkeys WHERE = 'cdkeys'");

 $query = mysql_query("SELECT * FROM cdkeys WHERE  columnname = 'cdkeys'");
于 2013-04-15T10:42:12.840 回答