You are on page 1of 6

Source Code

import mysql.connector as sql


conn=sql.connect(host='localhos
t',user='root',passwd='manager'
,database='shoe_billing')
#if conn.is_connected():
#print('connected
sucessfully')
conn.autocommit=True
c1=conn.cursor()
#c1.execute("create table
shoe_details(shoe_code int
primary key,brand_name
varchar(25),customer_name
varchar(25),customer_number,,cu
stomer_address,amount )")
c1=conn.cursor()
user=input("enter user")
passwd=input("enter password")
if user=='raghavan' and
passwd=='leo':
print("
shoe billing")
print("
")
print("1:ENTER CUSTOMER
DETAILS")
print("
")
print("2:SHOW CUSTOMERS
DETAILS")
print("
")
v_choice=int(input("enter
the choice"))
if v_choice==1 :
code=input("enter
code=")
brand =input("enter
brand=")
name=input("enter
customer name=")
number=input("enter
phone number=")
details=input
("adress=")
amount=input("amount=")
c1.execute("insert
into shoe_details values
("+code+",'"+brand+"'"+",'"+nam
e+"',"+number+",'"+details+"',"
+amount+")")
conn.commit()
elif v_choice==2:
v_code=input("enter
the code number")
c1.execute("select
* from shoe_details where
shoe_code ="+v_code)
data=c1.fetchall()
print("Shoe
code:",data[0][0])
print("brand
name:",data[0][1])
print("customer
name:",data[0][2])
print("customer
number:",data[0][3])
print("customer
detail:",data[0][4])
print("amoumt:",data[0][5])
Project Code
import mysql.connector as sql
conn=sql.connect(host='localhost',user='r
oot',passwd='kvs',database='shoe_billing'
)
if conn.is_connected():
print('connected sucessfully')
print('user =
raghavan','password=leo')
conn.autocommit=True
c1=conn.cursor()
c1.execute("create table if not exists
shoe_details(shoe_code int,brand_name
varchar(25),customer_name
varchar(25),customer_number
int,customer_address varchar(20),amount
int)")
c1=conn.cursor()
user=input("enter user: ")
passwd=input("enter password: ")
if user=='raghavan' and passwd=='leo':
print(" shoe
billing")
print("
")
print("1:ENTER CUSTOMER DETAILS")
print("
")
print("2:SHOW CUSTOMERS DETAILS")
print("
")
v_choice=int(input("enter the
choice"))
if v_choice==1:
# for i in range(20):
data=("""INSERT INTO
shoe_details(shoe_code,brand_name,custome
r_name,customer_number,customer_address,a
mount)VALUES (%s,%s,%s,%s,%s,%s)""")
code=input("enter code=")
brand =input("enter
brand=")
name=input("enter
customer name=")
number=int(input("enter
phone number="))
details=input ("adress=")
amount=input("amount=")
r=(code,brand,name,number,details,amount)
c1.execute(data,r)
conn.commit()
print ('Data stored
successfully \n quitting program')
elif v_choice==2:
v_code=input("enter the code
number")
c1.execute("select * from
shoe_details where shoe_code ="+v_code)
data=c1.fetchall()
print("Shoe code:",data[0]
[0])
print("brand name:",data[0]
[1])
print("customer
name:",data[0][2])
print("customer
number:",data[0][3])
print("customer
detail:",data[0][4])
print("amoumt:",data[0][5])
conn.commit()

You might also like