2013-03-01 6 views
0

Quelle est la syntaxe correcte pour sélectionner plusieurs lignes dans un tableau en utilisant Zend? Donc, en gros, récupère toutes les données qui portent le nom $a OR $b etc .. en augmentant le nombre d'éléments du tableau. Je ne peux pas le comprendre .......Sélectionnez Zend Db avec le tableau

public function selectRow($array) 
{ 
    $data = $this->table->select() 
         ->where('name = ?', $array); 
    return $this->table->fetchAll($data); 
} 

Répondre

1

Vous devez utiliser IN clause pour cela. Alors essayez,

$data = $this->table->select() 
        ->where('name IN (?)', $array); 
1

vous pouvez utiliser orWhere() dans le Zend_Db_Select. Consultez le manuel Zend_Db_Select::where().

public function selectRow($array) 
{ 
    $data = $this->table->select() 
         ->where('name = ?', $array) 
         ->orWhere('address = ?', $anotherarray); 
    return $this->table->fetchAll($data); 
} 
  • il serait préférable d'utiliser IN et NOT IN lorsque l'état où contient tableau de valeurs