I have a function to get all events information where users are invited.
in order to do so, I would like to pass user_id(INT) by reference.
function getAllEvents($read, $user_id) {
$sql = ‘SELECT * from events as e, invitations as i where e.event_id=i.event_id AND i.user_id= $user_id’;
return $read->fetchAll($sql);
}
it seems the way i used ‘$user_id’ is wrong, therefore, i keep getting the following message.
SQLSTATE[42S22]: Column not found: 1054 Unknown column ‘$user_id’ in ‘where clause’
All I want to do is just pass the integer($user_id) within the function to be included in the SQL query.
So sorry to ask the question like this, but i am stuck now…
please help me, thanks a lot.