A Database Error Occurred

Error Number: 1064

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 'AND DATEDIFF(NOW(),paid_datetime) <= 30 ) a , (SELECT IF(COUNT(id) IS NULL' at line 4

SELECT * FROM ( (SELECT IF(COUNT(id) IS NULL, 0 ,COUNT(id)) AS 30d FROM transaction WHERE pid= AND DATEDIFF(NOW(),paid_datetime) <= 30 ) a , (SELECT IF(COUNT(id) IS NULL, 0 ,COUNT(id)) AS 90d FROM transaction WHERE pid= AND DATEDIFF(NOW(),paid_datetime) <= 90 ) b, (SELECT IF(COUNT(id) IS NULL, 0 ,COUNT(id)) AS 300d FROM transaction WHERE pid= AND DATEDIFF(NOW(),paid_datetime) <= 300 ) c )

Filename: /var/www/html/models/report_model.php

Line Number: 22