Good Afternoon!
First time poster!
I keep running into this simple problem when trying to fill my 2d array from my SQL. For some reason it will not store the values into my variables. I am really not too sure what else to do here? It seems painfully obvious and is probably staring at me right in the face.
Here is my function -
My second print(Players[2][2]) shows the last 'players' in the list. every single players[1-5] is stored as the last item in my database.
Thank you
First time poster!
I keep running into this simple problem when trying to fill my 2d array from my SQL. For some reason it will not store the values into my variables. I am really not too sure what else to do here? It seems painfully obvious and is probably staring at me right in the face.
Here is my function -
def GetPlayerData(conn,cur):
rows, cols = (6, 6)
Players = [[0]*cols]*rows
cur.execute('SELECT * FROM Players')
for x in range (1,6):
nextline = cur.fetchone()
Players[x][0]= nextline['Players']
Players[x][1]= nextline['Total_Cash']
Players[x][2]= nextline['Risk_Level']
print(Players[x][0])
print(Players[2][2])
return PlayersMy first print(Players[x][0]) Displays the entire list as it cycles through x.My second print(Players[2][2]) shows the last 'players' in the list. every single players[1-5] is stored as the last item in my database.
Thank you
