0

Good afternoon Guys I am stuck here in a problem and I couldn't resolve it so had to ask here.The problem is that i want to load two functions

function FETCH_DATA($HOTEL_ID){
    $this->db->where(['hotel_id' => $HOTEL_ID]);

    $DATA   =   $this->db->get('hotel_tbl');
    return $DATA->result();

}

&

function FETCH_ASSOCIATION($HOTEL_ID){
    $this->db->where(['hotel_id' => $HOTEL_ID]);

    $ASSOCIATION = $this->db->get('hotel_association');
    return $ASSOCIATION->result();
}

from AdminModel.php in my AdminController.php whose code is as following

function DESCRIPTION(){
        $this->load->model('AdminModel');
        $HOTEL_ID   = $this->session->userdata('hotel_id');
        $a['data']  = $this->AdminModel->FETCH_DATA($HOTEL_ID);
        $this->load->view("Description", $a);
    }

Any help would be appreciated!

1
  • both methods belongs to which models? Commented Aug 21, 2017 at 11:45

2 Answers 2

1

pass the variables like this,

 $a['data1']  = $this->AdminModel->FETCH_DATA($HOTEL_ID);
 $a['data2']  = $this->AdminModel->FETCH_ASSOCIATION($HOTEL_ID);

and you are good to go!!

Sign up to request clarification or add additional context in comments.

1 Comment

@NOONE its strange that you have un-accept same answer of JYoThi which is answer earlier than this and accepted this answer
1

You can call more modal function and send data to view like below

function DESCRIPTION(){
        $this->load->model('AdminModel');
        $HOTEL_ID   = $this->session->userdata('hotel_id');
        $a['data1']  = $this->AdminModel->FETCH_DATA($HOTEL_ID);
        $a['data2']  = $this->AdminModel->FETCH_ASSOCIATION($HOTEL_ID);
        $this->load->view("Description", $a);
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.