Reputation: 81
I have tried to create a piece of code so when my game is over or the play wins he score is displayed in the database.
Game Code:
def gameover():
message = Msg("Game Over")
message.update()
player.kill()
shot.kill()
SQL = 'INSERT INTO TblScore(Score) VALUES (' + str(score.value)
Databaseconnector.INSERT(SQL)
Database Connection Code:
def INSERT(SQL):
print(SQL)
cursor.execute(SQL)
conn.commit()
Error:
ProgrammingError: ('42000', '[42000] [Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement. (-3502) (SQLExecDirectW)')
Upvotes: 0
Views: 568
Reputation: 360702
You forgot the closing bracket:
SQL = 'INSERT INTO TblScore(Score) VALUES (' + str(score.value) + ')'
^^^^^^^
Upvotes: 5