1

显示错误的 MySQL 查询有什么问题:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'index WHERE id=1' at line 1

相关代码:

$qu = mysql_query("SELECT * FROM index WHERE id= 1") or die("MySQL ERROR: ".mysql_error());

    WHILE($d = mysql_fetch_array($qu)):

    $con = $d['content'];

endwhile;
4

1 回答 1

7

index是一个MySQL 保留关键字,所以你必须用这样的反引号引用它:

SELECT * 
FROM `index` 
WHERE id = 1
于 2012-07-25T16:02:58.813 回答