Array
(
    [code] => 1064
    [message] => 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 c.type = 'doctor'
            INNER JOIN pe_photogallery_related d ON d.type' at line 7
    [query] => 
            SELECT a.head ,i.* FROM pe_photogallery_items AS i
            INNER JOIN pe_photogallery_albums AS a
            ON a.id = i.parent
            INNER JOIN pe_photogallery_checked AS c
            ON c.album_id = i.parent AND c.item_id = i.id
                AND c.entity_id = 
                AND c.type = 'doctor'
            INNER JOIN pe_photogallery_related d ON d.type = c.type
            AND d.related_id = 
            GROUP BY id
            ORDER BY d.id, i.priority
            
    [context] => /home/u49415/garant.ur.ru/www/engine/modules/classes/public/doctors/controller.php line 87
)