我不断收到此错误:为什么我的SQL不能工作?
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 ''food' ORDER BY 'id'' at line 1
如何解决呢?
<?php
require '113-connect-db.php';
$query = "SELECT * FROM 'food' ORDER BY 'id'";
if ($query_run = mysql_query($query)){
echo 'query successful';
} else {
echo mysql_error();
}
?>
看起来像单引号 – Joe 2012-01-26 22:18:31
表名和字段名称不应包含在单引号中。 – dasblinkenlight 2012-01-26 22:20:11