(Apr-12-2021, 05:59 PM)ibreeden Wrote: Not exactly what I hoped for. Can you not run it outside the web page? And in your code you print the tuple "myparams". What does it print? Are the parameters correct?
By the way, is this still your code?
myparams = (username, password, uuid.uuid1(), ) print(myparams) mysql = mycursor.execute("INSERT INTO user (username, userpassword, userguid ) VALUES (%s , %s, %s)") myresult = mycursor.execute(mysql, myparams) mydb.commit()You do twice "mycursor.execute()". That is not correct. It must be:
myparams = (username, password, uuid.uuid1(), ) print(myparams) mysql = "INSERT INTO user (username, userpassword, userguid ) VALUES (%s , %s, %s)" myresult = mycursor.execute(mysql, myparams) mydb.commit() mycursor.close() mydb.close()
Thank you! I updated the code and removed the double execute statements and updated the uuid1() to a string and its working now. Also, added the close statements. Below are the changes I made after your suggestions:
myparams = (username, password, str(uuid.uuid1()), ) print(myparams) mysql = "INSERT INTO user (username, userpassword, userguid ) VALUES (%s , %s, %s)" myresult = mycursor.execute(mysql, myparams) mydb.commit() mycursor.close() mydb.close()