I've just caught a bug in my PHP programming and i can figure out why, in my MVC controller, i have an if statement, however, when the controller is passed, it goes through both statements...
public function actionCheckin($id) {
$model = $this->loadScanningModel($id);
if($model->checkin_status_id == 0){
//checkin user
$model->checkin_status_id = 1;
$model->save();
$this->redirect(array('view', 'id' => $model->id, 'scanning' =>'success'));
}
else{
$this->redirect(array('view', 'id' => $model->id, 'scanning' =>'reg'));
}
}
What this will do is if the checkin_status_id = 0 it will run the first condition, but instead of ending the code with the redirect, it will run the else query and the condition has now been met with the if, and go to the other redirect...
What am i doing wrong?