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 'and nfu_art_category=8 and nfu_art_acti = 1 and substring_index(nfu_art_cgpath,'' at line 1 select count(*) from nfu_art_001,nfu_artcg_001 where 1=1 and nfu_art_owner = and nfu_art_category=8 and nfu_art_acti = 1 and substring_index(nfu_art_cgpath,',',1)=nfu_artcg_001.nfu_artcg_seq and (nfu_artcg_001.nfu_artcg_digestrule!='' or nfu_art_001.nfu_art_summary!='') and nfu_artcg_acti=1 order by nfu_art_order asc, nfu_art_date desc, nfu_art_seq desc