我正在尝试使用这个查询
$page_set = mysql_query("SELECT * FROM pages WHERE subject_id =
{$subject["id"]}", $connection);
但是我在加载我的页面时一直收到这个错误。
Database query failed: 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 '' at line 1
最佳答案
在没有复杂语法的情况下尝试一下:
$query = 'SELECT * FROM pages WHERE subject_id = ' . $subject['id'];
$page_set = mysql_query($query, $connection);
顺便说一句,我讨厌字符串中的变量解析,而更喜欢连接。
关于php - MYSQL查询错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4444925/