SQLSTATE[42804]: Datatype mismatch: 7 ERROR: argument of AND must be type boolean, not type integer LINE 1: ...d FROM user_events u WHERE (u.event_id = 8275 AND u.user_id ... ^