Ver Mensaje Individual
  #2 (permalink)  
Antiguo 30/10/2011, 08:52
Avatar de Ronruby
Ronruby
 
Fecha de Ingreso: julio-2008
Ubicación: 18°30'N, 69°59'W
Mensajes: 4.879
Antigüedad: 15 años, 9 meses
Puntos: 416
Respuesta: problema al hacer un filtrado

Toma tu consulta:
Código MySQL:
Ver original
  1. SELECT * FROM Peliculas WHERE 1=1
Y luego ve haciendo ifs independientes para que vayan agregando los parametros a la busqueda.

Código PHP:
Ver original
  1. if(!empty($_POST['genero'])) {
  2.   $consulta .= " genero = '{$_POST['genero']}'";
  3. }
  4. if(!empty($_POST['blahblah'])) {
  5.   $consulta .= " blahblah = '{$_POST['blahblah']}'";
  6. }
  7. //etc
  8. //y ejecuta tu consulta