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 'o = '1') OR (inicio <= '2014/10/22' and termino >= '2014-10-22' AND medidas = '' at line 1