SELECT COUNT(*) as num FROM tbl_item INNER JOIN tbl_itemcat ON tbl_item.id = tbl_itemcat.item_id WHERE tbl_item.status = 1 AND tbl_itemcat.cat_id=: 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 4