![Antiguo](http://static.forosdelweb.com/fdwtheme/images/statusicon/post_old.gif)
14/12/2011, 19:09
|
| | Fecha de Ingreso: septiembre-2009
Mensajes: 14
Antigüedad: 15 años, 4 meses Puntos: 0 | |
Consulta con BETWEEN creo q mi consulta between esta mal pero no se en que parte de esta
Código:
<?php
session_start();
if($_SESSION['registrado']=="si")
{
?>
<html>
<head>
<title>Libros Entregados en Determinada Fecha</title>
<link rel="stylesheet" type="text/css" href="calendario/tcal.css" />
<script type="text/javascript" src="calendario/tcal.js"></script></head>
<body background="fondo.jpg">
<script type="text/javascript">var MenuLinkedBy="AllWebMenus [4]",awmMenuName="menu",awmBN="854";awmAltUrl="";</script><script charset="UTF-8" src="menu.js" type="text/javascript"></script><script type="text/javascript">awmBuildMenu();</script>
<br><br><br>
<form ACTION="<?php echo $_SERVER['PHP_SELF']; ?>" METHOD="POST">
<table align="center">
<tr><td align="right">Rango de Fecha 1</td><td><input name="uno" class="tcal" style="font-weight: 700"/></td></tr>
<tr><td align="right">Rango de Fecha 2</td><td><input name="dos" class="tcal" style="font-weight: 700"/></td></tr>
<tr><td colspan="2" align="center"><input type="submit" name="enviar"></td></tr>
</table>
</form>
</body>
</html>
<?php
$link = mysql_connect("localhost","root","")
or die ("no se ha podido conectar");
mysql_select_db("biblioteca")
or die("Error al tratar de selecccionar esta base");
$sql = "SELECT * FROM prestamos WHERE f_entregado BETWEEN $_POST['uno'] AND $_POST['dos'] ORDER BY f_entregado ASC;";
$result = mysql_query("$sql")
or die(mysql_error());
echo "<table border='1' align='center'>";
echo "<tr> <th>ID del Prestamo</th> <th>Numero de control</th><th>Nombre Alumno</th><th>Clave del Libro</th><th>Titulo del Libro</th></tr>";
while($row = mysql_fetch_array( $result )) {
echo "<tr><td>";
echo $row['id'];
echo "</td><td>";
echo $row['no_control'];
echo "</td><td>";
echo $row['nombre'];
echo "</td><td>";
echo $row['clave'];
echo "</td><td>";
echo $row['titulo'];
echo "</td></tr>";
}
echo "</table>";
mysql_close($link);
}
else
header("location:index.php");
?>
|