I have a database containing the fields, username, password, scores, kills, and time. I'm trying to order all the records within by score in ascending order, so the highest score is at the top.
The function I have made to do this runs fine, and produces no errors, but doesn't change the order in any way.
Am I doing something wrong? All help appreciated.
The function:
# Orders database by high score
def order_db():
"""
Orders the database rows,
so first row has highest
score.
"""
open_db()
command = ("""
SELECT * FROM players
ORDER BY score ASC
""")
cur.execute(command)
close_db()
Full code: http://ift.tt/1p7yrFG
I have tried changing the function in different ways, using:
cur.executemany(command)
Or changing the format of the SQLite statement:
("""
SELECT * FROM players
ORDER BY score ASC;
""")
Aucun commentaire:
Enregistrer un commentaire