MySQL:运算符错误在phpmyadmin中运行,但不在php中运行

时间:2018-07-25 07:33:59

标签: mysql

我得到以下

select p.*, (select paypal_status from tbl_order as o where paypal_status = 'paid' and end_time > now() and p.post_id = o.post_id) as sort_post  from tbl_postad as p where post_category in ('1','7','14','20','26','32','38','44','50','56','62','68','74','80','97','140','144','150','177','179','235','259','284','298','334','370','397','410','429','450','467','479','495','522','535','543') and post_expiredate >= '2018-07-25 13:00:18' and post_delete_status!='Y' and post_cat_status!='N' and block = 0  and post_country = "India"  and post_status = 'Y' order by post_date desc LIMIT 0, 15
  

您的SQL语法有错误;检查手册   对应于您的MySQL服务器版本以使用正确的语法   在“ post_category”附近   ('1','7','14','20','26','32','38','44','50','56','62','68',' 74英寸   第1行

查询在phpmyadmin中正确执行:

select p.*, (select paypal_status from tbl_order as o where paypal_status = 'paid' and end_time > now() and p.post_id = o.post_id) as sort_post  from tbl_postad as p where post_category in ('1','7','14','20','26','32','38','44','50','56','62','68','74','80','97','140','144','150','177','179','235','259','284','298','334','370','397','410','429','450','467','479','495','522','535','543') and post_expiredate >= '2018-07-25 13:00:18' and post_delete_status!='Y' and post_cat_status!='N' and block = 0  and post_country = "India"  and post_status = 'Y' order by post_date desc LIMIT 0, 15

即使最短的查询也会返回错误:

select p.*, (select paypal_status from tbl_order as o where paypal_status = 'paid' and end_time > now() and p.post_id = o.post_id) as sort_post  from tbl_postad as p where post_status='Y' order by post_date desc LIMIT 0, 15
  

您的SQL语法有错误;检查手册   对应于您的MySQL服务器版本以使用正确的语法   在第1行的'post_status ='Y''附近

我的PHP版本:PHP版本5.6.36

0 个答案:

没有答案