Problem preparing query ( SELECT ext.*, SUM(yellow_cards) as totalYellow, SUM(red_cards) as totalRed, SUM(white_cards) as totalWhite, SUM(fairplay_points) as fairplay_points, SUM(fouls_points) as fouls_points, ((SUM(yellow_cards)*1)+(SUM(red_cards)*3)+(SUM(white_cards)*2)) as totalfair, count(matchid) as totalGames FROM ( SELECT matchday.*, team.name teamName, team.logo, team.foto, team.id teamId, team.id team_id, mat.id as matchid, mat.team1_yellow_cards as yellow_cards, mat.team1_red_cards as red_cards, mat.team1_white_cards as white_cards, mat.team1_fair_play as fairplay_points, mat.team1_fouls as fouls_points FROM bribeiro_masterfo_producao2018.mdb_matchdays matchday, bribeiro_masterfo_producao2018.mdb_matches mat, bribeiro_masterfo_producao2018.mdb_teams team, bribeiro_masterfo_producao2018.mdb_match_results result WHERE matchday.id=mat.matchday_id AND mat.team1_id= team.id AND mat.id = result.match_id AND matchday.tournament_id= ? UNION SELECT matchday.*, team.name teamName, team.logo, team.foto, team.id teamId, team.id team_id, mat.id as matchid, mat.team2_yellow_cards as yellow_cards, mat.team2_red_cards as red_cards, mat.team2_white_cards as white_cards, mat.team2_fair_play as fairplay_points, mat.team2_fouls as fouls_points FROM bribeiro_masterfo_producao2018.mdb_matchdays matchday, bribeiro_masterfo_producao2018.mdb_matches mat, bribeiro_masterfo_producao2018.mdb_teams team, bribeiro_masterfo_producao2018.mdb_match_results result WHERE matchday.id=mat.matchday_id AND mat.team2_id= team.id AND mat.id = result.match_id AND matchday.tournament_id= ?) ext WHERE ( teamId = OR teamId = OR teamId = 948 OR teamId = 448 OR teamId = 917 OR teamId = 696 OR teamId = 1117 OR teamId = 267 OR teamId = 340 OR teamId = 949) GROUP BY teamId ORDER BY totalfair ASC, name ASC ) 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 'OR teamId = OR teamId = 948 OR teamId = 448 OR teamId = 917 OR teamId = 696 OR ' at line 59
/home/bribeiro/masterfoot.bribeiro.net/edUtilsClass/edDbV2.php : 840
#0 /home/bribeiro/masterfoot.bribeiro.net/edUtilsClass/edDbV2.php(521): edDbV2->_prepareQuery() #1 /home/bribeiro/masterfoot.bribeiro.net/edProjectClass/edFairplayProject.php(191): edDbV2->rawQuery('\r\n\t\t\tSELECT \r\n\t...', Array) #2 /home/bribeiro/masterfoot.bribeiro.net/edProjectClass/edFairplayProject.php(213): edFairplayProject->getTableResult(Array, '484', 1) #3 /home/bribeiro/masterfoot.bribeiro.net/edProjectClass/edFairplayProject.php(12): edFairplayProject->showTableResults(Array) #4 /home/bribeiro/masterfoot.bribeiro.net/edUtilsClass/edBbCode.php(85): edFairplayProject->bbCodeReplacement('showList', Array) #5 /home/bribeiro/masterfoot.bribeiro.net/edUtilsClass/edBbCode.php(33): edBbCode->getReplacementForCode('edFairplayProje...', Array) #6 /home/bribeiro/masterfoot.bribeiro.net/edBaseClass/PageProject.php(191): edBbCode->convert('##edFairplayPro...', Array) #7 /home/bribeiro/masterfoot.bribeiro.net/edBaseClass/PageProject.php(1338): PageProject->showPageContent(Array) #8 /home/bribeiro/masterfoot.bribeiro.net/edBaseClass/PageProject.php(1360): PageProject->showPageContentV2Insite(Array) #9 /home/bribeiro/masterfoot.bribeiro.net/edBaseClass/PageProject.php(963): PageProject->showPageContentV2(Array) #10 /home/bribeiro/masterfoot.bribeiro.net/index.php(58): PageProject->show() #11 {main}