lay so ban ghi select count(*) from tbsanpham where `sanpham_trangthai` = 1 and `loaitin_id` = and `sanpham_vip` = 1 You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near 'and `sanpham_vip` = 1' at line 1