I want to know how to filter the retrieval of the records in my table. I am using grocery_crud on top of codeigniter. I don't know how to put a condition on the results that are retrieved. For example,i have a customers crud and i want to retrieve only the ones in new york. Please help
this is my function and i want to narrow the results before rendering the view
public function employees(){
$crud = new grocery_CRUD();
$crud->set_subject('employees');
$crud->set_table('employees');
$crud->columns('firstName','email');
$crud->display_as('firstName','first name');
$crud->display_as('email','e-mail address');
$crud->required_fields('email');
$output = $crud->render();
$this->output($output);
}
You would use the where function:
$crud->where('city','New York');
There are a lot of nifty functions available !
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.