public function getStudent($id){
$sth = $this->con->prepare("SELECT * FROM students WHERE id=:id");
$sth->bindParam("id", $id, PDO::PARAM_INT);
$sth->execute();
$student = $sth->fetchObject();
return $student;
}
(1) http://localhost/slim-framework/public/api/v1/student/1
(2) http://localhost/slim-framework/public/api/v1/student/1fgff
With 'GET' request using the code above, URL 1 and 2 above gave me the same result which suppose not to be.
Please, any help on how I can make URL 2 to flag error since it is not an integer?