[eluser]Unknown[/eluser]
Hi
I dive in CI and i thing it's great solution for wrighting CODE faster.
I have same questions.
-- usualy befor i start with CI i store SESSION data in $_SESSION[] like that
I make a query SELECT 8 FROM database WHERE userName = $usermane and userPass = $userpass
than i take the info from query and stored it to an array
$_SESSION['loged']=true;
$_SESSION['userInfo']=$result;
but i can;t find the solution in CI.
I made a costum data array with the post variables but i can't get furder to store the all information
in mw model i do this
Code:
function login(){
$username = $this->input->post('userName');
$userpass = $this->input->post('userPass');
$this->db->where('userName',$username);
$this->db->where('userPass',$userpass);
$data = $this->db->get('users');
if($data->num_rows()== 1){
return TRUE;
}
}
and than in my Controler
Code:
function valid_login(){
$this->form_validation->set_rules("userName","X",'required');
$this->form_validation->set_rules("userPass","X",'required');
if($this->form_validation->run()){
$this->load->model('M_input');
$result = $this->M_input->login();
if($result){
$user_data = array(
'is_loged' => TRUE,
'username' =>$this->input->post('userName'),
);
$this->session->set_userdata($user_data);
$this->index();
}
}
else{
$this->index();
}
}
And it's work but
i trayed to take info from the $result variable but noting.
Show me the light Thank you