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 product.id desc' at line 3
Error getvalue.select count(*) FROM sag_products as product INNER JOIN sag_product_images as productImg
ON product.id=productImg.product_id
WHERE product.is_active='t' and product.cid = '' AND product.id!='' AND product.p_type_id= order by product.id desc