我的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;
答案 0 :(得分:7)
index
是MySQL reserved keyword,所以你必须用这样的反引号引用它:
SELECT *
FROM `index`
WHERE id = 1