我正在尝试使用php ActiveRecord中的多个条件进行搜索
下面的代码全球搜索所有项目 我有一个名为mailin_order_status的列,并希望根据该值进行搜索。
我尝试了下面的代码。它可以工作,但它仍在全球范围内搜索而不仅仅是“新”包。在此先感谢!!
$app->get(
'/bag/search',
function () use ($app) {
$query = $app->request()->get('query');
$data['datacount'] = sizeof(Bag::find('all', array('conditions' => array('mailin_order_status = ?', 'new')), array('conditions' => "first_name LIKE '%$query%' OR last_name LIKE '%$query%' OR post_title LIKE '%$query%'")));
$data['searchconditions'] = "first_name LIKE '%$query%' OR last_name LIKE '%$query%'";
$data['bags']=Bag::find('all', array('conditions' => array('mailin_order_status = ?', 'new')), array('limit' => 10, 'conditions' => "first_name LIKE '%$query%' OR last_name LIKE '%$query%' OR post_title LIKE '%$query%'"));
$app->render(
'bag/search.php',$data
);
}
);