sql语句的PHP T字符串错误

时间:2015-07-21 04:51:26

标签: php mysql

我的PHP代码出现了一个奇怪的错误。它说有一个意外的T_CONSTANT_ENCAPSED_STRING错误,但我根本看不到它。

    $dateResult = mysqli_query($connection, 'select county, cuisine,
    count(*) from inspection, restaurant where inspection.rid = 
    restaurant.rid and inspection.passfail = ''PASS'' and idate like '$date%' 
    group by county, cuisine');

我假设它与我的模式'$ date%'或'PASS'有问题。

谢谢!

1 个答案:

答案 0 :(得分:3)

尝试此操作您的邮件是'"

 $dateResult = mysqli_query($connection, "select county, cuisine,
    count(*) from inspection, restaurant where inspection.rid = 
    restaurant.rid and inspection.passfail = 'PASS' and idate like '$date%' 
    group by county, cuisine");