嘿伙计我正在使用Riot Games API,我目前正在尝试将用户最近的游戏保存到我的数据库中以便以后处理。
这是我当前的查询。
$dbh = $this->database->prepare("INSERT INTO recent_games (
gameId, invalid, gameMode, gameType, subType, mapId, teamId, championId, spell1, spell2, level, ipEarned, createDate,
summonerId0, teamId0, championId0,
summonerId1, teamId1, championId1,
summonerId2, teamId2, championId2,
summonerId3, teamId3, championId3,
summonerId4, teamId4, championId4,
summonerId5, teamId5, championId5,
summonerId6, teamId6, championId6,
summonerId7, teamId7, championId7,
summonerId8, teamId8, championId8,
ingame_level, goldEarned, numDeaths,
turretsKilled, minionsKilled, championsKilled,
totalDamageDealt, totalDamageTaken, doubleKills,
killingSprees, largestKillingSpree, team, win,
neutralMinionsKilled, largestMultiKill,
physicalDamageDealtPlayer, magicDamageDealtPlayer,
physicalDamageTaken, magicDamageTaken,
largestCriticalStrike, timePlayed, totalHeal,
totalUnitsHealed, assists, item0, item1, item2,
item3, item4, item5, item6, magicDamageDealtToChampions,
physicalDamageDealtToChampions, totalDamageDealtToChampions,
trueDamageDealtPlayer,
trueDamageDealtToChampions, trueDamageTaken,
wardPlaced, neutralMinionsKilledEnemyJungle,
neutralMinionsKilledYourJungle, totalTimeCrowdControlDealt
)VALUES(
:gameId,
:invalid,
:gameMode,
:gameType,
:subType,
:mapId,
:teamId,
:championId,
:spell1,
:spell2,
:level,
:ipEarned,
:createDate,
:summonerId0,
:teamId0,
:championId0,
:summonerId1,
:teamId1,
:championId1,
:summonerId2,
:teamId2,
:championId2,
:summonerId3,
:teamId3,
:championId3,
:summonerId4,
:teamId4,
:championId4,
:summonerId5,
:teamId5,
:championId5,
:summonerId6,
:teamId6,
:championId6,
:summonerId7,
:teamId7,
:championId7,
:summonerId8,
:teamId8,
:championId8,
:ingame_level,
:goldEarned,
:numDeaths,
:turretsKilled,
:minionsKilled,
:championsKilled,
:totalDamageDealt,
:totalDamageTaken,
:doubleKills,
:killingSprees,
:largestKillingSpree,
:team,
:win,
:neutralMinionsKilled,
:largestMultiKill,
:physicalDamageDealtPlayer,
:magicDamageDealtPlayer,
:physicalDamageTaken,
:magicDamageTaken,
:largestCriticalStrike,
:timePlayed,
:totalHeal,
:totalUnitsHealed,
:assists,
:item0,
:item1,
:item2,
:item3,
:item4,
:item5,
:item6,
:magicDamageDealtToChampions,
:physicalDamageDealtToChampions,
:totalDamageDealtToChampions,
:trueDamageDealtPlayer,
:trueDamageDealtToChampions,
:trueDamageTaken,
:wardPlaced,
:neutralMinionsKilledEnemyJungle,
:neutralMinionsKilledYourJungle,
:totalTimeCrowdControlDealt
");
$dbh->execute(array(
"gameId" => $data['gameId'],
"invalid" => $data['invalid'],
"gameMode" => $data['gameMode'],
"gameType" => $data['gameType'],
"subType" => $data['subType'],
"mapId" => $data['mapId'],
"teamId" => $data['teamId'],
"teamId" => $data['teamId'],
"championId" => $data['championId'],
"spell1" => $data['spell1'],
"spell2" => $data['spell2'],
"level" => $data['level'],
"ipEarned" => $data['ipEarned'],
"createDate" => $data['createDate'],
"summonerId0" => $data['fellowPlayers'][0]['summonerId'],
"teamId0" => $data['fellowPlayers'][0]['teamId'],
"championId0" => $data['fellowPlayers'][0]['championId'],
"summonerId1" => $data['fellowPlayers'][1]['summonerId'],
"teamId1" => $data['fellowPlayers'][1]['teamId'],
"championId1" => $data['fellowPlayers'][1]['championId'],
"summonerId2" => $data['fellowPlayers'][2]['summonerId'],
"teamId2" => $data['fellowPlayers'][2]['teamId'],
"championId2" => $data['fellowPlayers'][2]['championId'],
"summonerId3" => $data['fellowPlayers'][3]['summonerId'],
"teamId3" => $data['fellowPlayers'][3]['teamId'],
"championId3" => $data['fellowPlayers'][3]['championId'],
"summonerId4" => $data['fellowPlayers'][4]['summonerId'],
"teamId4" => $data['fellowPlayers'][4]['teamId'],
"championId4" => $data['fellowPlayers'][4]['championId'],
"summonerId5" => $data['fellowPlayers'][5]['summonerId'],
"teamId5" => $data['fellowPlayers'][5]['teamId'],
"championId5" => $data['fellowPlayers'][5]['championId'],
"summonerId6" => $data['fellowPlayers'][6]['summonerId'],
"teamId6" => $data['fellowPlayers'][6]['teamId'],
"championId6" => $data['fellowPlayers'][6]['championId'],
"summonerId7" => $data['fellowPlayers'][7]['summonerId'],
"teamId7" => $data['fellowPlayers'][7]['teamId'],
"championId7" => $data['fellowPlayers'][7]['championId'],
"summonerId8" => $data['fellowPlayers'][8]['summonerId'],
"teamId8" => $data['fellowPlayers'][8]['teamId'],
"championId8" => $data['fellowPlayers'][8]['championId'],
"ingame_level" => $data['stats']['level'],
"goldEarned" => $data['stats']['goldEarned'],
"numDeaths" => $data['stats']['numDeaths'],
"turretsKilled" => $data['stats']['turretsKilled'],
"minionsKilled" => $data['stats']['minionsKilled'],
"championsKilled" => $data['stats']['championsKilled'],
"totalDamageDealt" => $data['stats']['totalDamageDealt'],
"totalDamageTaken" => $data['stats']['totalDamageTaken'],
"doubleKills" => $data['stats']['doubleKills'],
"killingSprees" => $data['stats']['killingSprees'],
"largestKillingSpree" => $data['stats']['largestKillingSpree'],
"team" => $data['stats']['team'],
"win" => $data['stats']['win'],
"neutralMinionsKilled" => $data['stats']['neutralMinionsKilled'],
"largestMultiKill" => $data['stats']['largestMultiKill'],
"physicalDamageDealtPlayer" => $data['stats']['physicalDamageDealtPlayer'],
"magicDamageDealtPlayer" => $data['stats']['magicDamageDealtPlayer'],
"physicalDamageTaken" => $data['stats']['physicalDamageTaken'],
"magicDamageTaken" => $data['stats']['magicDamageTaken'],
"largestCriticalStrike" => $data['stats']['largestCriticalStrike'],
"timePlayed" => $data['stats']['timePlayed'],
"totalHeal" => $data['stats']['totalHeal'],
"totalUnitsHealed" => $data['stats']['totalUnitsHealed'],
"assists" => $data['stats']['assists'],
"item0" => $data['stats']['item0'],
"item1" => $data['stats']['item1'],
"item2" => $data['stats']['item2'],
"item3" => $data['stats']['item3'],
"item4" => $data['stats']['item4'],
"item5" => $data['stats']['item5'],
"item6" => $data['stats']['item6'],
"magicDamageDealtToChampions" => $data['stats']['magicDamageDealtToChampions'],
"physicalDamageDealtToChampions" => $data['stats']['physicalDamageDealtToChampions'],
"totalDamageDealtToChampions" => $data['stats']['totalDamageDealtToChampions'],
"trueDamageDealtPlayer" => $data['stats']['trueDamageDealtPlayer'],
"trueDamageDealtToChampions" => $data['stats']['trueDamageDealtToChampions'],
"trueDamageTaken" => $data['stats']['trueDamageTaken'],
"wardPlaced" => $data['stats']['wardPlaced'],
"neutralMinionsKilledEnemyJungle" => $data['stats']['neutralMinionsKilledEnemyJungle'],
"neutralMinionsKilledYourJungle" => $data['stats']['neutralMinionsKilledYourJungle'],
"totalTimeCrowdControlDealt" => $data['stats']['totalTimeCrowdControlDealt']
));
这是我收到的错误。
Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[42000]: Syntax error or access violation: 1064 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 '' at line 111' in
尝试调试此错误的最佳方法是什么?在phpMyAdmin中加载虚拟数据以获得更详细的错误消息的希望是极其困难的。任何建议都会很棒。
答案 0 :(得分:1)
添加misisig close括号)
第111行是
:totalTimeCrowdControlDealt
并且您没有关闭值部分