SQL error occurred in statement
select g.* , ifnull(icedate,' TBA') icedate , icehour, ifnull(arenaname,'TBA') arenaname,arenamap,arenaaddress, v.teamname vtn,v.associationid vai, va.associationname van,va.associationpassword vap,va.associationlocal val,l.teamname ltn,l.associationid lai,la.associationname lan,la.associationpassword lap,la.associationlocal lal,keepstandings,d.categoryid,d.levelid from games g join team v on (v.teamid = visitor) join association va on (va.associationid = v.associationid) join team l on (l.teamid = local) join association la on (la.associationid = l.associationid) join division d on (d.divisionid = g.divisionid) left outer join icedates idt using (icedateid) left outer join ice i using (iceid) left outer join arena a using (arenaid)where g.divisionid = and gamestatus > 0 order by icedate,icehour,arenaname,gameid
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 gamestatus > 0 order by icedate,icehour,arenaname,gameid' at line 9