Consulta Invalida: 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 year(fechaevento)=' at line 1 En esta parte de la consulta: select id, alcance, day(fechaevento) as dia from agenda where month(fechaevento)= and year(fechaevento)=