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 precio BETWEEN 5000 AND 8000' at line 1SELECT count(*) as cantidad FROM articulos WHERE idarticulo in () AND precio BETWEEN 5000 AND 8000