$db = $this->getAdapter(); $select = $db->select(); $select->from($this->_name); $select->where('ip = ?', '120.0.0.1'); $select->orWhere('login = ?', 'test'); $subQuery = $select->getPart(Zend_Db_Select::WHERE); $select->reset(Zend_Db_Select::WHERE); $select->where(implode(' ', $subQuery)); $select->where('created_at = ?', date('Y-m-d')); $res = $select->query()->fetchAll();This will create sql with WHERE clause like as: "((ip = '127.0.0.1') OR (login = 'test')) AND (created_at = '2015-03-24')"
2015-03-24
How to group WHERE clause in zf1
Subscribe to:
Posts (Atom)