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