Error in executing SQL string: SELECT COUNT(*) FROM g_gallery as p left join gl_galleries as b on p.gl_id = b.gl_id WHERE (p.g_inuse = 1) and (p.gl_id = 25) and ((b.gl_location_id = ) or (b.gl_location_id = 0)) and (b.gl_inuse = 1)

error: 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 ') or (b.gl_location_id = 0)) and (b.gl_inuse = 1)' at line 1