PHP降级版本从7降为5结果问题

时间:2018-07-05 20:24:22

标签: php wordpress php-7

我这里有这行代码,可在PHP v7上运行,但在php5上却收到mysql语法错误。

 $row_sub = $wpdb->get_results( "SELECT *  from $sub_service WHERE subid IN($str_sub_serviced) ORDER BY subname ASC");

错误日志

 WordPress database error 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 ') ORDER BY subname' at line 1 for query SELECT *  from mtd_subservices WHERE subid IN() ORDER BY subname made by require

什么是php5的正确解决方案?

我尝试过arsort($ row_sub),但没有成功。

谢谢

1 个答案:

答案 0 :(得分:0)

在不带或带空参数的情况下调用“ IN()”时,MySQL返回此确切的语法错误,因此请确保$str_sub_serviced是字符串而不是空的。