MYSQL查询错误

I'm trying to use this query

$page_set = mysql_query("SELECT * FROM pages WHERE subject_id =
            {$subject["id"]}", $connection);

but i keep getting this error when loading my page .

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

Try it without the complex syntax:

$query = 'SELECT * FROM pages WHERE subject_id = ' . $subject['id'];
$page_set = mysql_query($query, $connection);

Incidentally, I loathe variable parsing in strings, and prefer concatenation.

you're experiencing a quote mismatch. try replacing the double quotes around your array key with single quotes.

$page_set = mysql_query("SELECT * FROM pages WHERE subject_id =
            {$subject['id']}", $connection);
$sql = "SELECT * FROM pages WHERE subject_id = '".$subject["id"]."'";
$page_set = mysql_query($sql, $connection);

Make sure you escape the subject_id also.

use single quote