Python MySql Connector Not enough parameters for the SQL statement
Question:
Can’t Insert Values into MySql Database Using This Piece Of Code:
def CreateUser(Name, Password, Email, Version):
global user
print(Password)
user = [tuple(Name), tuple(Email), tuple(Password), tuple("User"), tuple("0"), tuple(Version)]
my_cursor.executemany(f"INSERT INTO users (usersUid, usersEmail, usersPwd, UsersPerms, usersMoney, gameVersion) VALUES (%s, %s, %s, %s, %s, %s)", user)
database.commit()
Tried to Insert Values/Data to MySql Database Using Function and Succesfully Inserting it without problems when Code was a little bit edited it worked on MySql Workbench, every value should be correct and there’s needed amount of it 6 are data I need and theres 7 in WorkBench Display but thats Id So I skipped that
Answers:
def CreateUser(Name, Password, Email, Version):
global user
print(Password)
user = [(Name, Email, Password, "User", "0", Version)]
my_cursor.executemany(f"INSERT INTO users (usersUid, usersEmail, usersPwd, UsersPerms, usersMoney, gameVersion) VALUES (%s, %s, %s, %s, %s, %s)", user)
database.commit()
Can’t Insert Values into MySql Database Using This Piece Of Code:
def CreateUser(Name, Password, Email, Version):
global user
print(Password)
user = [tuple(Name), tuple(Email), tuple(Password), tuple("User"), tuple("0"), tuple(Version)]
my_cursor.executemany(f"INSERT INTO users (usersUid, usersEmail, usersPwd, UsersPerms, usersMoney, gameVersion) VALUES (%s, %s, %s, %s, %s, %s)", user)
database.commit()
Tried to Insert Values/Data to MySql Database Using Function and Succesfully Inserting it without problems when Code was a little bit edited it worked on MySql Workbench, every value should be correct and there’s needed amount of it 6 are data I need and theres 7 in WorkBench Display but thats Id So I skipped that
def CreateUser(Name, Password, Email, Version):
global user
print(Password)
user = [(Name, Email, Password, "User", "0", Version)]
my_cursor.executemany(f"INSERT INTO users (usersUid, usersEmail, usersPwd, UsersPerms, usersMoney, gameVersion) VALUES (%s, %s, %s, %s, %s, %s)", user)
database.commit()