Objective : If the database returns the number 1 , then it redirects to setup page, if it returns 2 , its redirect to setup page 2 if it returns 0 then it activates else statement
I have been trying this out for awhile but still seem to get it to work
My Controller :
$user_id = array('id'=>$this->loggedInUser->id);
$results = $this->user_model->getUsersStage($user_id);
if($results == '1'){
redirect('registration/setup');
}
My Model :
function getUsersStage($conditions=array(),$fields='')
{
if(count($conditions)>0)
$this->db->where($conditions);
$this->db->from('users');
if($fields!=''){
$this->db->select($fields);
}
else{
$this->db->select('stage');
}
$result = $this->db->get();
return $result;
}//End of getUsersStage Function
Would be nice if you could let me know what went wrong, I tried lots of comparison method , like
if($results == 1){
Error : Object of class CI_DB_mysql_result could not be converted to int
if(this->$results->stage == 1)
just to verify, $this->loggedInUser is working and it does send the correct sql statement to the model.
Change
to