Answer the question
In order to leave comments, you need to log in
Why do I get pymysql.err.OperationalError:?
Help me get error - pymysql.err.OperationalError: (1364, "Field 'id' doesn't have a default value")
code below.
from connection import connect
def register(user_id):
connection = connect()
try:
with connection.cursor() as cursor:
result = cursor.execute(f"SELECT * FROM accounts WHERE uid={user_id}")
xiy = cursor.fetchone()
if result == 0:
cursor.execute(f'INSERT INTO accounts(uid) VALUES({user_id})')
connection.commit()
else:
return xiy
finally:
connection.close()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question