'inserting data to mysql using python QT and mysql database
I'm struggling to insert or retrive data from database I tried and I watched many tutorials but every time it stops in cur.execute(). i found problem is in the value like self.FirstNmae.text() funtion stop here
def SignupFunction(self):
try:
connection = pymysql.connect(host=cr.host, user=cr.user, password=cr.password, database=cr.database)
cur = connection.cursor()
cur.execute("insert into users (FirstNmae , LastName, Email,Password , Confirm_Paswword ,Answer) value( %s, %s, %s, %s, %s, %s)",
(
self.FirstNmae.text(),
self.LastName.text(),
self.Email.text(),
self.Password.text(),
self.Confirm_Paswword.text(),
self.Answer.text()
))
connection.commit()
connection.close()
self.labelResult.setText("Data Inserted ")
except Exception as e:
self.labelResult.setText("Error Inserting Data")
Solution 1:[1]
hello friend i'm not able to comment so i will post as answer from your code you are a new developer , your function is good there are no problem in it i think that the problem is in you database look at the database if you are missed something or you mess write attributes like FirstNmae
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | devnoob999 |
