Welcome Guest, Not a member yet? Register   Sign In
Storing data in controller
#1

[eluser]condoace[/eluser]
I need some help with a simple solution regarding getting data from a model and storing individual data in variables within the controller, here is my code.. not sure if im on the right track:

CONTROLLER

Code:
function getdata {

$this->load->model('m_model');

$request_data = $this->m_model->get_data()

$d1 = $request_data->id;

$d2 = $request_data->first_name;

$d3 = $request_data->last_name;

}

MODEL

Code:
function get_data() {
  
    $this->db->select('id, first_name,last_name, email, credits, job_title,department');
    
    $result = $this->db->get('employees');
    
    return $result->result();
  
  }




Theme © iAndrew 2016 - Forum software by © MyBB