Skip to content
Permalink
Browse files
Update info.py
  • Loading branch information
carreira committed Nov 30, 2018
1 parent c0bd9f7 commit 36e2f391c07187569ec5cecfb5d08f1843ea6dec
Showing 1 changed file with 13 additions and 9 deletions.
22 info.py
@@ -46,12 +46,16 @@ def ownInfo(sentence):

""" "add" new values to table favourite """
def getInfo(nick, info):
print("I don't know yours, what is it? ")
ans = input("")
connect = connection() # gets the details to the database
cursor = connect.cursor() # establish a cursor to fetch the results wanted from the databse
sql = 'UPDATE favourite SET '+info+'="'+ans+'" WHERE NICKNAME="'+ nick + '"' #sql gets the order to update all info from the table favourite in the current user row
cursor.execute(sql) # order to select executed
connect.commit() # tell the database to save all the changes
print("Ok, I will try not to forget!")

try:
print("I don't know yours, what is it? ")
ans = input("")
connect = connection() # gets the details to the database
cursor = connect.cursor() # establish a cursor to fetch the results wanted from the databse
if info in "footballplayer":
info = "football_player"
sql = 'UPDATE favourite SET '+info+'="'+ans+'" WHERE NICKNAME="'+ nick + '"' #sql gets the order to update all info from the table favourite in the current user row
cursor.execute(sql) # order to select executed
connect.commit() # tell the database to save all the changes
print("Ok, I will try not to forget!")
except:
print("I am not able to rember that, I am sorry.")

0 comments on commit 36e2f39

Please sign in to comment.