TENGO QUE CREAR UN BUSCADOR HOTELERO MULTICRITERIO EL CUAL FILTRE POR CONTACTO (HOTELES), CIUDADES Y CATEGORIA.
EL SIGUIENTE CODIGO ES EL PROGRAMA QUE ESTA DIVIDIDO EN DOS PARTE: LA BUSQUEDA Y EL RESULTADO.
AGRADECERIA ME AYUDEN YA QUE EL TIEMPO CORRE.
GRACIAS.
<?
include ("inicio.php");
// Listado de Contactos
// Armo una coneccion al servidor mysql
$coneccion = mysql_connect($host_db, $usuario_db, $pass_db);
mysql_select_db($base_db, $coneccion);
if ($tipo == "buscar")
{
// Busco todos los tipos de contactos disponibles
$sql = "select * from tipo_contactos order by desc_tipo_contacto ";
$resulta = mysql_query($sql, $coneccion);
$sql = "select * from ciudades order by desc_ciudad ";
$result = mysql_query($sql, $coneccion);
// Armo el formulario de busqueda
?>
<form method="POST" action="lcontactos.php">
<table border="0" width="100%">
<tr>
<td width="100%" colspan="2" bgcolor="#DBDBDB"><b>Buscar Hoteles</b></td>
</tr>
<tr>
<td width="30%">
<p align="right">Buscar: </td>
<td width="70%"><input type="text" name="buscar" size="32"></td>
</tr>
<tr>
<td width="30%" height="25">
<p align="right">Ciudad: </td>
<td width="70%" height="25"><select size="1" name="ciudad">
<option value="" selected>Todas las Ciudades</option>
<?
// Muestro todos los tipos de contactos para armar la lista desplegable
while($myrow = mysql_fetch_array($result))
{
echo "<option value=$myrow[id_ciudad]>$myrow[desc_ciudad]</option>";
}
?>
</select></td>
</tr>
<tr>
<td width="30%" height="25">
<p align="right">Categoria: </td>
<td width="70%" height="25"><select size="1" name="cod_tipo_contacto">
<option value="" selected>Todas las Categorias</option>
<?
// Muestro todos los tipos de contactos para armar la lista desplegable
while($myrow = mysql_fetch_array($resulta))
{
echo "<option value=$myrow[id_tipo_contacto]>$myrow[desc_tipo_contacto]</option>";
}
?>
</select></td>
</tr>
<tr>
<td width="30%"></td>
<td width="70%"><input type="submit" value="Enviar" name="envio"></td>
</tr>
</table>
</form>
<p> </p>
<?
}
else
{
// Listamos los contactos
// Armo la consulta
$sql = "select * from contactos, tipo_contactos, ciudades
where cod_tipo_contacto = id_tipo_contacto and contactos.id_ciudad = ciudades.id_ciudad ";
if ($buscar != '')
{
$sql.=" and ((apellido like '%$buscar%') or (nombre like '%$buscar%')) ";
}
if ($cod_tipo_contacto != '')
{
$sql.=" and cod_tipo_contacto = $cod_tipo_contacto ";
}
if ($ciudad != '')
{
$sql.=" and id_ciudad = $ciudad ";
}
// Ordeno
if ($orden != '')
{
$sql.=" order by $orden ";
}
$resultado = mysql_query($sql, $coneccion);
if (mysql_error())
{
echo "ERROR al agregar el Tipo de Contacto - ". mysql_errno().":". mysql_error()."<br>";
}
// Calculo la cantidad de resultados
$cant_resultados = mysql_num_rows($resultado);
if ($cant_resultados >= 1)
{
// Muestro los resultados
echo "Se han encontrado $cant_resultados resultados<br>";
?>
<?
while($myrow = mysql_fetch_array($resultado))
{
// Armo link para editar
$leditar = "econtactos.php?id_contacto=$myrow[id_contacto]";
$lborrar = "bcontactos.php?id_contacto=$myrow[id_contacto]";
?>
<table border="1" width="100%" cellpadding="4" cellspacing="0">
<tr>
<td width="100%" bgcolor="#DBDBDB"><b><? echo "Hotel $myrow[apellido]"; ?> <? echo $myrow[nombre]; ?></b></td>
</tr>
<tr>
<td width="100%">Ciudad: <? echo $myrow[desc_ciudad]; ?></td>
</tr>
<tr>
<td width="100%">Categoria: <? echo $myrow[desc_tipo_contacto]; ?></td>
</tr>
<tr>
<td width="100%">Dirección: <? echo $myrow[direccion]; ?></td>
</tr>
<tr>
<td width="100%">Teléfono: <? echo $myrow[telefono]; ?></td>
</tr>
<tr>
<td width="100%">E-mail: <? echo $myrow[e_mail]; ?>
| Web Site: <? echo $myrow[web_site]; ?> </td>
</tr>
<tr>
<td width="100%">Observaciones: <? echo $myrow[observaciones]; ?></td>
</tr>
<tr>
<td width="100%"><a href="<? echo $leditar; ?>">Editar</a> <a href="<? echo $lborrar; ?>">Borrar</a></td>
</tr>
</table>
<?
} // end while
}
else
{
echo "No se han encontrado resultados coincidentes<br>";
}
}
include("pie.php");
?>
ME GUSTARIA SABER CUAL ES EL ERROR QUE TENGO YA QUE ASI COMO ESTA ME TIRA ERROR EN LA LINEA 123 PERO NO SE CUAL ES EL ERROR.
MUCHAS GRACIAS....