I am trying to add new data to my mysql database using tkinter in python. Does anyone have any best practices for doing this? I have tried thus far to no avail.

thanks in advance for any help.

I suggest to execute sql queries on the database using module MySQLdb.

Just keep in mind that the TkInter portion is seperate from the database portion. i.e. TkInter has nothing to do with connecting with the database, even though your program uses both.

The reason I'm saying this is that googling "using tkinter with mysql python" probably wouldn't get you as usefull results as googling "tkinter python" and seperatly gooling "mysql python", and gluing them togeather yourself.

Thanks for the quick reply, I am indeed using the mysqld module which has worked thus far for queries, but I am just not able to get it working for adding to a DB. I am going to try a simple sql statement to see if it works. I am fairly certain I am doing something wrong lol :)

If you are unable to get it to work, try writting out a 5 line script that just connect to the database and run's a query. If that works, then you might be able to use that example in your program. If it doesn't work, and if you've investigated it, then post the simplified code with any errors you get here.

It sounds like it might be an issue with the setup as opposed to the code, but I could be wrong.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.