Jun-09-2021, 01:53 PM
Hi guys, I need little help with the code below. I want to edit the guest room, name or surname, but I get "near "(": syntax error".
Any help is appreciated, Thank you!
This is the table:
![[Image: Screenshot-2021-06-01-at-15-25-38.png]](https://i.ibb.co/MCS0860/Screenshot-2021-06-01-at-15-25-38.png)
Code:
Any help is appreciated, Thank you!
This is the table:
![[Image: Screenshot-2021-06-01-at-15-25-38.png]](https://i.ibb.co/MCS0860/Screenshot-2021-06-01-at-15-25-38.png)
Code:
def editGuest(): viewGuests() print("Choose room number:") roomNumber = input() print("You choose", 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(room) SET room = {} WHERE room = {}").format(newRoom, roomNumber) con.commit() elif userInput == "2": print("Enter new name") newName = input() cur.execute("UPDATE Guest(name) SET name = {} WHERE room = {}").format(newName,roomNumber) con.commit() elif userInput == "3": print("Enter new Surname") newSurname = input() cur.execute("UPDATE Guest(surname) SET surname = {} WHERE room = {}").format(newSurname,roomNumber) con.commit() else: print("Invalid Input") except sqlite3.Error as e: print(e)