2011-09-15 36 views

回答

1

phpactiverecord documentation

# fetch all the cheap books! 
Book::all(array('conditions' => 'price < 15.00')); 
# sql => SELECT * FROM `books` WHERE price < 15.00 

# fetch all books that have "war" somewhere in the title 
Book::find('all', array('conditions' => "title LIKE '%war%'")); 
# sql => SELECT * FROM `books` WHERE title LIKE '%war%' 
+0

直兩者是啊,它不是直到後來我完全意識到我試圖做一切完全錯誤..不只是通配卡位。謝謝。 – chris

+0

@tobydavies非常感謝。經過這麼多時間的努力,它給了我很多幫助,它從未打動過我。然而,是否有可能混合使用這種格式的數組('conditions'=> array('cond1','cond2')表示cond1是否爲正常條件,cond2是否爲LIKE條件? – Maximum86

+0

@ LuyandaSiko http://www.phpactiverecord.org/projects/main/wiki/Finders#conditions,該部分的第二個示例塊具有多種條件的語法。 – tobyodavies