Fechas
Publicado por Carolina Martinez (1 intervención) el 22/08/2008 18:44:02
Hola a todos estoy haciendo un filtro por fechas pero no me sale no se que estoy haciendo mal, donde 'fecha_entrega' y 'fecha_entrega2 son mis variables.' (Parametros)
<?php
$sql="Select m.Cod_Prog,m.Fecha_Inicio,m.Fecha_Final,p.Nom_Inst,p.Cod_Prog,u.Nombres,i.Nombre,p.Estado,e.Nombre_E,p.Estado_Email
From estado e,pro_cap p,usuarios u, institucion i,pro_cap_maestra m
Where m.Cod_Prog=p.Cod_Prog and i.Codigo=p.Nom_Inst and u.Id_Usuarios=m.Cedula and e.Codigo = p.Estado";
// print $sql;
if (isset($_POST['fecha_entrega']))
if (isset($_POST['fecha_entrega2']))
{
$sql=$sql." and m.Fecha_Inicio >= ".$_POST["fecha_entrega"]."And m.Fecha_Inicio
<= ".$_POST["fecha_entrega2"];
}
$sql=$sql." Order By m.Cod_Prog DESC,m.Fecha_Inicio DESC,m.Fecha_Final DESC";
// echo $sql;
if ($Base->consulta($sql))
{
?>
<?php
$sql="Select m.Cod_Prog,m.Fecha_Inicio,m.Fecha_Final,p.Nom_Inst,p.Cod_Prog,u.Nombres,i.Nombre,p.Estado,e.Nombre_E,p.Estado_Email
From estado e,pro_cap p,usuarios u, institucion i,pro_cap_maestra m
Where m.Cod_Prog=p.Cod_Prog and i.Codigo=p.Nom_Inst and u.Id_Usuarios=m.Cedula and e.Codigo = p.Estado";
// print $sql;
if (isset($_POST['fecha_entrega']))
if (isset($_POST['fecha_entrega2']))
{
$sql=$sql." and m.Fecha_Inicio >= ".$_POST["fecha_entrega"]."And m.Fecha_Inicio
<= ".$_POST["fecha_entrega2"];
}
$sql=$sql." Order By m.Cod_Prog DESC,m.Fecha_Inicio DESC,m.Fecha_Final DESC";
// echo $sql;
if ($Base->consulta($sql))
{
?>
Valora esta pregunta


0