[eluser]netrox[/eluser]
Just exactly how do I retrieve data as array and then assigning it to $data[var]?
For example I want to get an array of two fields such as userID and username from a table and I create a function in model class:
Code:
function getUser($email, $password)
{
$data=array();
$sql="SELECT * FROM users";
$query=$this->db->query($sql);
$row=$query->row();
$data['firstname']=$row['firstname'];
$data['userID']=$row['userID'];
return $data;
}
But the thing is I don't understand how I can get data array to be passed to controller from model. I wrote like this but it doesn't seem right:
Code:
$data['user']=$this->Musers->getUser($email, $pswd);
It doesn't seem right because I need to know which var is userID and firstname. Doing $this->session->set_userdata('userID', $data['userID']) does not seem right to me either. How do I exactly assign the data array to a returned $data from model to controller?