error en query: SELECT s.idSector, s.Nombre, sp.IdPeriodo, sp.Activo FROM bef_Sector AS s Inner Join bef_SectorPeriodo AS sp ON s.idSector = sp.IdSector WHERE sp.Activo = 1 and s.idSector = 68?id_periodo=20 ORDER BY sp.IdPeriodo desc LIMIT 1 XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX check the manual that corresponds to your XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX near '?id_periodo=20 ORDER BY sp.IdPeriodo desc LIMIT 1' at line 10