A Database Error Occurred

Error Number: 1064

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near ') AND `p`.`status` = 'accepted' AND `p`.`failed` = 0 AND `p`.`deleted` = 0 AN...' at line 7

SELECT DISTINCT `p`.`id` FROM `photos` AS `p` JOIN `users` AS `u` ON `u`.`id`=`p`.`user_id` JOIN `countries` AS `c` ON `c`.`id`=`p`.`country_id` JOIN `continents` AS `continent` ON `c`.`continent_id`=`continent`.`id` WHERE ( ) AND `p`.`status` = 'accepted' AND `p`.`failed` = 0 AND `p`.`deleted` = 0 AND `p`.`type` = 'buy' AND `u`.`deleted` = 0 AND `p`.`in_gallery` = 1 GROUP BY `p`.`id`

Filename: models/Photo_model.php

Line Number: 325