Ver Mensaje Individual
  #5 (permalink)  
Antiguo 10/09/2012, 10:19
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años
Puntos: 2135
Respuesta: Select con opcion de TODO

Con un simple if:
Código PHP:
Ver original
  1. // query sin la opción where
  2. $query = "SELECT * FROM foo";
  3. if ($miopcion != 'todo') { // si la opcion es diferente de todo agregas el where
  4.         $query .= " WHERE bar='$miopcion'";
  5. }