Click Fraud Protection
PHP related blog, freelancer to hire!

Zend_db_table how to find row by multiple columns?

Maybe should dig more in ZF API, but found simple solution:

class YourClass extends Zend_Db_Table_Abstract
public function findOneByParams(array $params)
// prepare query
$query = $this->select();
// add our terms
foreach ($params as $param => $value)
$query->where($param.' = ?', $value);
// find row
$row = $this->fetchRow($query);
// return
return $row;
1 Comment
  1. da best. Keep it going! Thank you

Leave a Reply