简体   繁体   English

杂货杂货过滤问题

[英]Grocery crud filtering issue

I want to know how to filter the retrieval of the records in my table.我想知道如何过滤我表中记录的检索。 I am using grocery_crud on top of codeigniter.我在 codeigniter 之上使用杂货_crud。 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.例如,我有一个客户 crud,我只想检索纽约的客户。 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:您将使用where函数:

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

There are a lot of nifty functions available !有很多漂亮的功能可用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM