python

Python Gui Last Insert ID Python Mysql

This tutorial will teach you how to get the Last Inserted id in python mysql. i will teach step by step.it will help you to make a inventory system. from tkinter import * from tkinter import messagebox import mysql.connector def Ok(): empname = e2.get() phone = e3.get() salary = e4.get() mysqldb=mysql.connector.connect(host=”localhost”,user=”root”,password=””,database=”payrollpy”) mycursor=mysqldb.cursor() try: sql =

Python Gui Last Insert ID Python Mysql Read More »

View records table using Python tkinter mysql

This tutorial will teach you how to View records using python mysql to the table. import tkinter as tk from tkinter import ttk import mysql.connector def show(): mysqldb = mysql.connector.connect(host=”localhost”, user=”root”, password=””, database=”smschool”) mycursor = mysqldb.cursor() mycursor.execute(“SELECT id,stname,course,fee FROM record”) records = mycursor.fetchall() print(records) for i, (id,stname, course,fee) in enumerate(records, start=1): listBox.insert(“”, “end”, values=(id, stname,

View records table using Python tkinter mysql Read More »

Search using python tkinter mysql

This tutorial will teach you how to search using python Gui application connect with mysql. from tkinter import * import mysql.connector def Ok(): global myresult studname = e1.get() coursename = e2.get() fee = e3.get() mysqldb=mysql.connector.connect(host=”localhost”,user=”root”,password=””,database=”smschool”) mycursor=mysqldb.cursor() try: mycursor.execute(“SELECT * FROM record where id = ‘” + studname + “‘”) myresult = mycursor.fetchall() for x in

Search using python tkinter mysql Read More »

Insert Records using Python tkinter mysql

This tutorial will teach you how Insert  the Records using Python and mysql. Establish the database connection.   from tkinter import * from tkinter import messagebox import mysql.connector def Ok(): studname = e1.get() coursename = e2.get() feee = e3.get() mysqldb=mysql.connector.connect(host=”localhost”,user=”root”,password=””,database=”smschool”) mycursor=mysqldb.cursor() try: sql = “INSERT INTO record (id,stname,course,fee) VALUES (%s, %s, %s, %s)” val =

Insert Records using Python tkinter mysql Read More »