Hola ,
Tengo este código y cuando se ejecuta No me da ningún fallo, llega hasta el final, (ninguna habitación disponible)
Pero no me da ningún resultado
¿Dónde puede estar el fallo?
Código PHP:
<?php
include 'headerFooter.php';
include 'validar_popu.php';
include 'validar_datos.php';
include 'conexion.php';
/* la página web comienza aquí */
if($_POST["cliente"] > "")
{
writeHeader("Confirmation");
/* página 4 */
footer();
} else if($_POST["id_habitacion"] > "")
{
writeHeader("Reserve a Room, Reserve un Espacio ");
/* página 3 */
footer();
} else
{
writeHeader("");
/* Forma de búsqueda */
$fecha_entrada=validDate($_POST["fecha_entradadaYear"] . "-" . $_POST["fecha_entradaMonth"] . "-" . $_POST["fecha_entradaDay"]);
$fecha_salida=validDate($_POST["fecha_salidaYear"] . "-" . $_POST["fecha_salidaMonth"] . "-" . $_POST["fecha_salidaDay"]);
print <<<EOT
<center>
<form action="bnb.php" method="post" name="reservation">
<table border="1">
<tr>
<td>adultos</td><td>entrada</td><td>salida</td>
</tr>
<tr>
<td><select name="adultos">
EOT;
for($i = 1; $i < 11; $i++)
{
if ($_POST["adultos"] == $i)
{
print "<option value='$i' SELECTED>$i</option>\n";
} else {
print "<option value='$i'>$i</option>\n";
}
}
print "</select></td>\n<td>";
print datePopups($fecha_entrada, fecha_entrada);
print "</td><td>";
print datePopups($fecha_salida, fecha_salida);
print <<<EOT
</td>
</tr>
</table><br>
<input type="submit" value="disponivilidad"></form>
</center>
EOT;
if($_POST["adultos"] > "")
{
$myQuery = "SELECT habitacion.id_habitacion, nombre, descricion, ocupacion_maxima, tarifa ";
$myQuery = $myQuery . " FROM habitacion, Reserva ";
$myQuery = $myQuery . " WHERE habitacion.id_habitacion = Reserva.id_habitacion ";
$myQuery = $myQuery . " AND ocupacion_maxima >= " . $_POST["adultos"] ;
$myQuery = $myQuery . " AND fecha_entrada >= '" . $_POST["fecha_entrada"] . "' ";
$myQuery = $myQuery . " AND fecha_salida <= '" . $_POST["fecha_salida"] . "' ";
$myQuery = $myQuery . " GROUP BY id_habitacion, nombre, descricion, ocupacion_maxima, tarifa ";
$myQuery = $myQuery . " HAVING count(*) > 0 ";
$myQuery = $myQuery . " ORDER BY ocupacion_maxima asc, tarifa desc ";
$resultado = mysql_query($myQuery, $link)
or die("error ");
if (mysql_num_rows($resultado) > 0)
{
print "<center><br><br>Resultados<BR><table border=1 width=90%><tr><th></th><th>Nombre</th><th>Descricion</th><th>Maxima<br>Ocupacion</th><th>tarifa</th></tr>\n";
while ($row = mysql_fetch_array($resultado))
{
print "<tr><td><A HREF='reservation.php?id_habitacion=" . $row["id"] . "'&fecha_entrada=" . $_POST["fecha_entrada"] . "&fecha_salida=" . $_POST["fecha_salida"] . ">Reservas</td><td>" . $row["nombre"] . "</A></td><td>" . $row["descricion"] . "</td><td>" . $row["ocupacion_maxima"] . "</td><td>" . $row["tarifa"] . "</td></tr>";
}
print "</table></center><br>";
} else {
print "<center> ningúna habitacion disponible.</center><br>";
}
mysql_close($link);
}
footer();
}
?>