I need little help with my query. I want to update specific value room,name,surname however I'm getting error no such column. Any help is appreciated.
Here is my code:
def editGuest():
viewGuests()
print("Choose room number:")
roomNumber = input()
print("You chooose", roomNumber)
try:
cur = con.cursor()
cur.execute("SELECT room,name,surname FROM Guest WHERE room = {}".format(roomNumber))
rowz= cur.fetchone()
print("ROOM", "\tNAME", "\tSURNAME")
print(rowz[0],rowz[1],rowz[2])
print("What would you like to change?")
print("1 - Room, 2 - Guest Name, 3 - Guest Surname")
userInput = input()
if userInput == "1":
print("Enter new room number")
newRoom = input()
cur.execute("UPDATE Guest SET room = {} WHERE room = {}".format(newRoom, roomNumber))
con.commit()
elif userInput == "2":
print("Enter new name")
newName = input()
cur.execute("UPDATE Guest SET name = {} WHERE room = {}".format(newName,roomNumber))
con.commit()
elif userInput == "3":
print("Enter new Surname")
newSurname = input()
cur.execute("UPDATE Guest SET surname = {} WHERE room = {}".format(newSurname,roomNumber))
con.commit()
else:
print("Invalid Input")
except sqlite3.Error as e:
print(e)