Fatal error: Uncaught exception 'Exception' with message: 'SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near ")" LINE 6: AND () AND p.userid IN ($1,$2) AND p.granted = '1' AND (p... ^