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()