I am trying to create a def within a class which stores an employees information. I am having trouble adding the data to the table. I am not too sure where I am going wrong and I can't seem to find the solution after looking at other posts.
def create_db(self):
name = input('Enter first name: ')
surname = input('Enter last name: ')
age = int(input('Enter age: '))
email = input('Enter e-mail address: ')
number = int(input('Enter number: '))
country = input('Enter country: ')
city = input('Enter city: ')
id = random.randint(0,9999)
query = "INSERT INTO employees (id, name, surname, age, email, number, country, city) VALUES (%s, %s)"
value = f"'{id}', '{name}', '{surname}', '{age}', '{email}', '{number}', '{country}', '{city}'"
self.mycursor.execute(query, value,)
self.db.commit()
I believe it is to do with the last 4 lines but may be incorrect. Thanks for any help in advance.