Welcome Guest, Not a member yet? Register   Sign In
[Session] ID of account from accounts table
#2

(This post was last modified: 01-24-2015, 12:41 AM by Smith.)

Hi, please make these changes. you have several errors in the code. Before using codeigniter you should learn to program in php

membership_model:
PHP Code:
function validate($name$pass)
 
   {
 
       $this->db->where('name'$name);
 
       $this->db->where('password'$pass);
 
       $this->db->limit(1);
 
       $query $this->db->get('accounts');
 
       
        if
($query->num_rows == 1)
 
       {
 
              return $query->row();
 
       }
 
   

controller:
PHP Code:
$name $this->input->post('name'TRUE);
$password sha1($this->input->post('password'TRUE));

$query $this->membership_model->validate($name$pass);

$data = array(
 
               'name' => $query->name,
 
               'is_logged_in' => true
                
'id'      =>    $query->id,
 
           );
 
           $this->session->set_userdata($data);
 
           redirect('accounts/'); 
Reply


Messages In This Thread
RE: [Session] ID of account from accounts table - by Smith - 01-24-2015, 12:38 AM



Theme © iAndrew 2016 - Forum software by © MyBB