[英]Zend multiple where
我有下一個代碼,但是他不起作用:
$select_sell = $this->select();
$select_sell->from($this->_name, array('rank_id'))
->where('rank_id = ?', $id)
->where('type = ?', 'must_sell');
$result = $this->fetchAll($select_sell)->count();
我需要進行此查詢... WHERE rank_id = $id AND type = 'must_sell'..
謝謝玩具。
正如戈登在他的評論中所說,type不是變量:
$select_sell = $this->select();
$select_sell->from($this->_name, array('rank_id'))
->where('rank_id = ?', $id)
->where('type = "must_sell"');
$result = $this->fetchAll($select_sell)->count();
幾次遇到這個問題。 你可以這樣解決
$select_sell = $this->select();
$select_sell->from($this->_name, array('rank_id'))
->where("(rank_id = $id AND type = 'must_sell')");
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.