Jump to content

Proble with WHERE

codeigniter grocerycrud where

  • Please log in to reply
No replies to this topic

#1 Majimazuri



  • Members
  • Pip
  • 2 posts

Posted 23 November 2015 - 05:54 PM


I have problem and I am requesting for your help

I am trying to use WHERE depending on user inputs; i would like if there is no user inputs system should take default settings from the db but if there is user inputs the system should use it; I have the following codes but do not work! Please help me; Thanks.


public function show_list()
        //Page title
        $data['page_title'] = 'Users List';
        if( $this->require_min_level(1) ){
                    //if there is iputs data for custom selection do this
            if($testdate1=="" && $testdate2=="")
                //this load sytem data in order to use it in quering the db
                        foreach ($system_data->result() as $sdata){
                        $data['financial_year_start'] = $sdata->financial_year_start;
                        $data['financial_year_end'] = $sdata->financial_year_end;
                //if there is iputs data for custom selection do this
                        $data = array(
                                'financial_year_start' => $this->input->post('start_date'),
                                'financial_year_end' => $this->input->post('end_date'),
        $crud = new grocery_CRUD();
        $crud->where('employed_date>=', $data['financial_year_start']);
        $crud->where('employed_date<=', $data['financial_year_end']);
        $crud->columns('user_id', 'first_name', 'last_name','gender','user_name','mobile_number','user_email','company_division','job_position', 'office_location', 'employed_date');
        $crud->fields('user_id', 'first_name', 'last_name','gender','user_name','mobile_number','user_email','company_division','job_position', 'office_location', 'employed_date');
         // edit how columm data are desplayed
        $crud->display_as('employed_date', 'Employed');
        //prevent unwanted operations
        //render data
        $output = $crud->render();
 //call aotput function
        $this->_users_list_output($data, $output);         
    function _users_list_output($data, $output = null)
 if( $this->require_min_level(1) ){
         //load view
        $this->load->view('includes/header', $data);


Also tagged with one or more of these keywords: codeigniter, grocerycrud, where

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users