this is the code of the following function
Function:
def dishID():
query = 'select count(*), max(DishID) from Dish'
cur.execute(query)
fetch = cur.fetchall()
for i in fetch:
if i[0] == 0:
return 1
else:
return (int(i[1]) + 1)
Error code
dishname = input('Enter Dish Name: ')
dishprice = input('Enter Dish Price: ')
dishid = str(dishID())
query = 'insert into Dish values({}, {}, {})'.format(
dishname, dishprice, dishid)
cur.execute(query)
con.commit()
print("Dish has added successfully")
Full code: https://srcb.in/l1RdtphmhF
This is code is restaurant Database management system. I am taking the help of mysql and making this system. when i try to enter values I get the error mentioned in the title.
The error is at line 99.