jquery - PHP ActiveRecord: How do I add multiple conditions for a query? -
i'm trying search more 1 condition in php activerecord
the code bellow searches globally items.
have column named mailin_order_status , search based on value.
i tried code below. works still searching globally , not "new" bags. in advance!!
$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 '%$query%' or last_name '%$query%' or post_title '%$query%'"))); $data['searchconditions'] = "first_name '%$query%' or last_name '%$query%'"; $data['bags']=bag::find('all', array('conditions' => array('mailin_order_status = ?', 'new')), array('limit' => 10, 'conditions' => "first_name '%$query%' or last_name '%$query%' or post_title '%$query%'")); $app->render( 'bag/search.php',$data ); } );
Comments
Post a Comment