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