-1

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);
    }
Alin Dima
  • 181
  • 14
  • 2
    There are either too many possible answers, or good answers would be too long for this format. Please add details to narrow the answer set or to isolate an issue that can be answered in a few paragraphs.I would suggest that you find a development forum (perhaps [quora](http://www.quora.com/Computer-Programming)?) to work out generalities. Then, when/if you have specific coding issues, come back to StackOverflow and we'll be glad to help. – Jay Blanchard Jun 29 '15 at 16:34
  • i have edited my post in order to be more specific – Alin Dima Jun 29 '15 at 16:41

1 Answers1

1

You would use the where function:

$crud->where('city','New York');

There are a lot of nifty functions available!

Jay Blanchard
  • 34,243
  • 16
  • 77
  • 119