Ver Mensaje Individual
  #3 (permalink)  
Antiguo 13/08/2011, 09:51
vortexjgh
 
Fecha de Ingreso: abril-2009
Mensajes: 2
Antigüedad: 15 años
Puntos: 0
Tema resuelto Criterios independientes

Muchisimas gracias TRIBY

He podido solucionar el problema con tu ayuda.

este es el código, por si a alguien le ayuda:


Código PHP:
Ver original
  1. <?php
  2. $filtros = array();
  3.  
  4.  if(!empty($_REQUEST['hab'])) {
  5.     $filtros[] = "hab = '{$_REQUEST['hab']}'";
  6.   }
  7.  if(!empty($_REQUEST['zona'])) {
  8.     $filtros[] = "zona = '{$_REQUEST['zona']}'";
  9.   }
  10.  if(!empty($_REQUEST['tipo'])) {
  11.     $filtros[] = "tipo = '{$_REQUEST['tipo']}'";
  12.   }
  13.     $filtro = implode(' AND ', $filtros);
  14.  
  15.  
  16. $conexion=mysql_connect("localhost","root","") or
  17.   die("Problemas en la conexion");
  18. mysql_select_db("lloguers",$conexion) or
  19.   die("Problemas en la selección de la base de datos");
  20. $tabla=mysql_query("select ind, ref, hab, cap, foto, zona, enlace
  21.                       from apt where $filtro",$conexion) or
  22.   die("Problemas en el select:".mysql_error());
  23.  
  24.  
  25. ?>
Saludos

Tema resuelto.

Última edición por vortexjgh; 13/08/2011 a las 09:57