$user = Model_Profile::find()->where('user_id', $id)->get_one();
$user = Model_Profile::query()->where('user_id', $id)->get_one();
public function action_view($id = null) { $data = null; if (!$id) { Session::set_flash('error', 'user not found'); Response::redirect('error'); return false; } $check = Model_User::find($id); if (!$check) { Session::set_flash('error', 'user not found'); Response::redirect('/error'); return false; } //real user do whatever }
/users/view/1
/users/view/2
/users/view/1somerandomstringso because the database field is an integer is it automatically going to just take an integer? I guess what i'm asking is where does this happen, and can I safely assume that if the wrong data types are presented to a model are they just ignored? Before I would do some sort of variable filter like
if(filter_var($id,FILTER_VALIDATE_INT) == false) { header("Location: /error.php?error=23"); exit; }
It looks like you're new here. If you want to get involved, click one of these buttons!