public function getProfile($user_id)
{
$stmt = $this->_connection->prepare("SELECT * FROM Profile WHERE profile_id = :profile_id");
$stmt->execute(['profile_id'=>$user_id]);
$stmt->setFetchMode(PDO::FETCH_CLASS, "Profile_model"); //datatype user
return $stmt->fetch(); //it should return a user
}
Hi as I wrote my code here.
When we prepare for PDO, it is prepare("SELECT * FROM Profile WHERE profile_id = :profile_id");
and why is there : in front of profile_id?
and $stmt->execute(['profile_id'=>$user_id]);
so as far as I know, => is like definition so the left side would be a key and the right side would be a value so does that mean that profile_id variable will have a value of $user_id
?