
10/03/2009, 09:06
|
 | | | Fecha de Ingreso: septiembre-2008
Mensajes: 182
Antigüedad: 16 años, 6 meses Puntos: 2 | |
Respuesta: Consulta de una fecha a otra fecha Fijate me sale este error
La consulta falló: 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 'BETWEEN '01/01/2009' and '02/01/2009' at line 1
y estoy haciendo asi:
$dia1=$_POST['dia1'];
$mes1=$_POST['mes1'];
$ano1=$_POST['ano1'];
$fecha_desde=($dia1 ."/". $mes1 ."/". $ano1);
$dia2=$_POST['dia2'];
$mes2=$_POST['mes2'];
$ano2=$_POST['ano2'];
$fecha_hasta=($dia2 ."/". $mes2 ."/". $ano2);
$sql=mysql_query("SELECT * from eventualidades where $fecha_inicio BETWEEN '$fecha_desde' and '$fecha_hasta")or die("La consulta falló: " . mysql_error()); |