讯睿CMS问答:统计数量标签是不是不支持查询这种的条件就可以或者这样的条件就

讯睿CMS问答:统计数量标签是不是不支持查询这种的条件就可以或者这样的条件就

2024-07-07 XunRuiCMS Sincere

问题:

统计数量标签是不是不支持like查询

{count action=sql sql='SELECT * FROM dr_1_share_category WHERE `dr_1_share_category`.`pid` IN (532) ' } {$debug_count}

这种的where条件就可以

{count action=sql sql='SELECT * FROM dr_1_share_category WHERE `dr_1_share_category`.`name` LIKE '%关键词%' ' } {$debug_count}

或者

{count action=sql sql='SELECT * FROM dr_1_share_category WHERE name LIKE '%关键词%' ' } {$debug_count}

这样的where条件就报错了 ,好像 '%关键词%' 没传递过去一样

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

#SQL:SELECT count(*) as ct FROM dr_1_share_category where `dr_1_share_category`.`name` LIKE

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

#SQL:SELECT count(*) as ct FROM dr_1_share_category WHERE name LIKE

是不是要添加转意符,怎么弄?指点下

答案:

标签里面不能出现嵌套引号

{php $sql=urlencode("SELECT * FROM dr_1_share_category WHERE name LIKE '%关键词%' ");}

{count action=sql sql=$sql} {$debug(标签诊断器)_count}

创始人辛苦了 😀 😀 😀 😀

迅睿框架创始人:已经解决,好了的