[eluser]exodus7[/eluser]
Hey guys, I got another newbie problem:
I'm trying to pass a value from my query results from my model to the controller and store the value the session.I got the isLOGGED session data working fine, its just the uid session data that isn't working...
This is my model:
Code:
<?
class Loginmodel extends Model {
function Loginmodel()
{
parent::Model();
}
function process()
{
$username = $this->input->post('username');
$password = $this->input->post('password');
$query = $this->db->query("SELECT COUNT(*) as counted FROM users WHERE username = '$username' AND userpassword = '$password'");
$row = $query->row();
return $row->counted;
}
function getCurUser()
{
$username = $this->input->post('username');
$password = $this->input->post('password');
$query = $this->db->query("SELECT (*) FROM users WHERE username = '$username' AND userpassword = '$password'");
return $query;
}
}
?>
The controller:
Code:
function login()
{
$data['base'] = $this->config->item('base');
$data['result'] = $this->loginmodel->process('users');
if($this->loginmodel->process('users') == 1) {
$this->session->set_userdata('isLOGGED', 'YES');//set session variable
$this->loginmodel->getCurUser($_POST);
$this->session->set_userdata('uid', $query['uid']);//NOT WORKING
$this->template->load('template_adminPage', 'admin/home', $data);
} else {
$this->template->load('template_adminPage', 'admin/loginFailed', $data);
}
}
Any help is very much appreciated :-)
Thanks