So currently my table is as follow:
name -> type
--------------------------------
gameid -> mediumint(7)
timestamp -> timestamp
duration -> decimal (5,5)
winner -> varchar(20)
winner_score -> int(1)
loser -> varvhar(20)
loser_score -> int(1)
Now, I'm able to connect to the database, but I'm getting a warning when inserting a new row to the database:
Warning: Out of range value for column 'duration' at row 1
For the duration I am calculating the start and end time and subtracting it. I played around with it by rounding it (thought it was the decimal issues) and passing it as a string, but it looks like this:
gametime = round((time.time() - start_time),5)
Tried playing around with what I have written for it, which looks like:
cur.execute("INSERT INTO scores (duration, winner, winner_score, loser, loser_score) \
VALUES(%s, %s, %s, %s, %s)", (gametime, red_p, red_s, blue_p, blue_s))
For some reason, I keep getting the error. Not sure if the %s is what is affecting it. On the MySQL backend, everything is good, except that the duration (regardless of the length) will always be 0.99999. Any help?