You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM reports AS r INNER JOIN categories AS c ON r.cat_id = c.id and report_custo' at line 1