2011-11-11 20 views
0

例如活動的查詢,如果我有這樣的臺詞:重新啓動在笨

$this->db->where("blabla",$blala); 

而下面這條線,我決定不使用這種where子句(在運行時),並開始做從頭開始查詢。我如何忽略活動記錄中的where子句?

回答

0

也許你可以試試

$this->db->_reset_select(); 
4

你不能。

這是一個你必須理解的邏輯問題。

與其說

$this->db->where('blabla', $blala); 
if($dont_use_where_clause) { 
    //something to ignore the where cause which CI doesn't provides anyway 
} 

這就像開始你的車,並試圖找回你用來啓動它的燃料。
你將不得不做一些更符合邏輯是這樣的:

if(!$dont_use_where_clause) { 
    $this->db->where('blabla', $blala); 
} 

這是有道理的,因爲它是做這些事情的邏輯方式。這就像說'如果我不想使用燃料,不要開車'。得到它?