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 '' at line 1 SQL=SELECT q.*, (SELECT count(id) FROM `cb63z_questionnaire_data` AS qd WHERE qd.qid=q.id) AS dataCount FROM `cb63z_questionnaires` AS q WHERE q.published = 1 AND q.start_date <= '2025-04-21 07:18:58' AND q.end_date >= '2025-04-21 07:18:58' AND q.pid=