Welcome Guest, Not a member yet? Register   Sign In
data pass through session
#5

[eluser]shahmy[/eluser]
zreedeecom, I do what you post, but i cant pass id form model to my controller, I copy my code with this post, please help me,

"model"
function validate()
{
$this->load->database();
$this->db->where('username', $this->input->post('username'));
$this->db->where('password', md5($this->input->post('password')));
$query = $this->db->get('teacher');


if($query->num_rows > 0)
{

$row = $query->row();

return $row->tech_id;
}

//return true;


}

"controller"
function validate_users($tech_id)
{

$this->form_validation->set_rules('username', 'Username', 'required');
$this->form_validation->set_rules('password', 'Password', 'required');

if ($this->form_validation->run() == FALSE)
{
$this->index();
}

else
{


$this->load->model('teachers_model');
$query = $this->teachers_model->validate();

if($query) // if the user's credentials validated...
{
$data = array(
'tech_id'=>$tech_id,
'username' => $this->input->post('username'),
'is_logged_in' => true
);
$this->session->set_userdata($data);
redirect('main/teachers/memberarea');
}

}
}
Thank You.


Messages In This Thread
data pass through session - by El Forum - 08-23-2010, 04:52 AM
data pass through session - by El Forum - 08-23-2010, 09:18 AM
data pass through session - by El Forum - 08-25-2010, 12:47 AM
data pass through session - by El Forum - 08-25-2010, 02:58 AM
data pass through session - by El Forum - 08-26-2010, 02:50 AM
data pass through session - by El Forum - 08-26-2010, 04:20 AM
data pass through session - by El Forum - 08-27-2010, 11:19 PM
data pass through session - by El Forum - 08-28-2010, 04:50 AM



Theme © iAndrew 2016 - Forum software by © MyBB