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 (h.tarih BETWEEN s.bas_tarih AND s.bit_tarih)
group ' at line 16
SELECT SQL_CALC_FOUND_ROWS fg.id,fgr.aciklama,CONCAT(fg.klasor_ad,'/',min(fgr.resim)) AS resim,
IF(h.mac_id>0,CONCAT(t1.ad,' ',CAST(m.gol1 AS CHAR),':',CAST(m.gol2 AS CHAR),' ',t2.ad),fg.galeri_ad) AS galeri_ad
FROM (foto_galeri fg,foto_galeri_resimler fgr,foto_galeri_iller fgi)
LEFT JOIN haberler h ON(h.galeri_id=fg.id AND h.durum=1)
LEFT JOIN haber_iller hi ON(hi.haber_id=h.id)
LEFT JOIN ligler l ON(l.id=hi.lig_id)
LEFT JOIN sezon s ON(s.lig_id=l.id)
LEFT JOIN maclar m ON(m.id=h.mac_id)
LEFT JOIN takimlar t1 ON(m.takim1_id=t1.id)
LEFT JOIN takimlar t2 ON(m.takim2_id=t2.id)
WHERE fgr.galeri_id=fg.id and (fgi.il_id=34 or 34=0 or fgi.il_id=0)
and fg.uygulama_id=5
AND (h.tip_id=2 OR 2=0) AND fg.id=fgi.foto_galeri_id
AND s.sene=2024
AND l.id=
AND (h.tarih BETWEEN s.bas_tarih AND s.bit_tarih)
group by fg.id
order by fg.id desc ,fgr.id
limit 0,15