
consulta sobre fechas en postgresql
Publicado por luis (20 intervenciones) el 29/09/2014 21:30:40
resulta que hago una consulta de fechas desde hasta cuando realizo la consulta me devuelve tooooodas las fechas...
no me devuelve el rango que quiero ...
html
php
y me vuelve todas las fechas registradas
podria ayudarme
no me devuelve el rango que quiero ...
html
1
2
3
4
5
6
7
8
9
10
11
12
13
</head>
<body>
<form action="consultarfecha2.php" method="post" class="registro">
<input type="date" name="fecha" />
<input type="date" name="fecha5" />
<input type="submit" value="consultar" />
</form>
</body>
</html>
php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php
$fecha = $_REQUEST['fecha'];
$fecha2=date("y-m-d",strtotime($fecha));
echo "Desde";
echo $fecha2;
echo "<br />";
$fecha5 = $_REQUEST['fecha5'];
$fecha5=date("y-m-d",strtotime($fecha5));
echo "Hasta";
echo $fecha5;
include ('conect_bd.php');
$query2 = "SELECT * FROM planpag WHERE fecha BETWEEN '$fecha2' AND '$fecha5'";
//$query2 = "SELECT * FROM planpag WHERE fecha BETWEEN '$fecha2' AND '$fecha5'";
//$query2 = "SELECT monto, banco, numeroref, fecha FROM planpag WHERE fecha>='$fecha2' AND fecha<='$fecha5' ORDER BY fecha desc";
$query2 = pg_query($query2);
while($row = pg_fetch_array($query2,NULL,PGSQL_ASSOC))
{
echo "<table align='center' class='registro'>";
echo "</tr>";
// echo "<td width='200'><b>Cedula:</b><br />" . $row['fecha2'] . "</td>";
echo "<td width='200'><b>Fecha de Deposito:</b><br />" . $row['fecha'] . "</td>";
echo "<td width='200'><b>Banco:</b><br />" . $row['banco'] . "</td>";
echo "<td width='200'><b>Numero de Referencia:</b><br />" . $row['numeroref'] . "</td>";
echo "<td width='200'><b>Pago.</b><br />" . $row['monto'] . "</td>";
echo "</tr>";
echo "</table>";
echo "<br />";
}
?>
y me vuelve todas las fechas registradas
podria ayudarme
Valora esta pregunta


0