0% found this document useful (0 votes)
3 views

Python Project Full

The document outlines a Python script for managing a CD and DVD store using MySQL. It includes functionalities for creating tables for CD details, DVD details, user login, and online orders, as well as user interactions for logging in, creating accounts, and adding items to a cart. The script also handles user input for various operations and commits changes to the database.

Uploaded by

sarma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Python Project Full

The document outlines a Python script for managing a CD and DVD store using MySQL. It includes functionalities for creating tables for CD details, DVD details, user login, and online orders, as well as user interactions for logging in, creating accounts, and adding items to a cart. The script also handles user input for various operations and commits changes to the database.

Uploaded by

sarma
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

CD & DVD

MANAGEMENT
import mysql.connector as sql

conn=sql.connect(host="localhost", user="root", passwd="manager",database="dvd")

if conn.is_connected():

print("connected")

c1=conn.cursor()

c1.execute('create table cd_details(year_of_release int, type_of_movie varchar(65) ,


movie_name varchar(65), language varchar(56))')

print("table created")

import mysql.connector as sql

conn=sql.connect(host="localhost", user="root", passwd="manager",database="dvd")

if conn.is_connected():

print("connected")

c1=conn.cursor()

c1.execute('create table login_id( user_id int(11) primary key,passwd int(11),name


varchar(65))')

print("table created")

import mysql.connector as sql

conn=sql.connect(host="localhost", user="root", passwd="manager",database="dvd")

if conn.is_connected():

print("connected")

c1=conn.cursor()

c1.execute('create table dvd_detail(dvd_model varchar(65),dvd_name


varchar(56),version int,range_of_amt int)')

print('created')
import mysql.connector as sql

conn=sql.connect(host="localhost", user="root", passwd="manager",database="dvd")

if conn.is_connected():

print("connected")

c1=conn.cursor()

c1.execute('use dvd')

print("table created")

v_user_id=int(input("enter id:"))
v_passwd=int(input("enter password:"))

v_name=input("enter ur name")

V_SQL_INSERT="insert into login


values("+str(v_user_id)+","+str(v_passwd)+",'"+v_name+"')"

c1.execute(V_SQL_INSERT)

print("LOGIN DONE")

import mysql.connector as sql

conn=sql.connect(host="localhost", user="root", passwd="manager",database="dvd")

if conn.is_connected():
print("connected")
c1=conn.cursor()

c1.execute('create table online(customer_name varchar(100),age int,mobile_number


int,cd_or_dvd varchar(65),rating int)')

print("table created")

import mysql.connector as sql

conn=sql.connect(host="localhost", user="root", passwd="manager",database="dvd")

if conn.is_connected():
print("HELLO")
c1=conn.cursor()

c1.execute('use dvd')

c1=conn.cursor()

print("WELCOME TO SAINIK CD,DVD STORE")

print(' ')

print(' ')

from time import gmtime,strftime

a=strftime("%a,%d%b%y",gmtime())
print(a)

print(' ')

print(' ')

name=input("enter your name:")

n=name.capitalize()

print(' ')

print(' ')

print('OUR HEARTY WELCOMES TO',n)

print(' ')

print(' ')

print("1.login")
print("2.To create account")

print("3.exit")

print('')

print('')
choice=int(input("enter your choice:"))

print(' ')

print(' ')

if choice==1:
a=int(input("enter user_id:"))

c1.execute("select passwd from login_id where user_id = "+str(a)+";")

data=c1.fetchall()

data=data[0]

data=list(data)

data=data[0]

data=str(data)

print(' ')
print(' ')

b=int(input("enter passwd:"))

conn.cursor()

conn.commit()

print(' ')

print('4.online order')

print(' ')

print(' ')

print('5.cd details')

print(' ')

print(' ')
print('6.dvd details')

print(' ')

print(' ')

print('7.job oppurtunities')
print(' ')

print(' ')

choice2=int(input("enter your choice to see cd and dvd(5 or 6) and for online order(4):"))

if choice2==5:
v_year_of_release=int(input("enter the year:"))

v_language=input("enter ur language:")

print("1.horror")

print("2.comedy")

print("3.action")

print("4.inspiration")

print("5.sentimental")

v_type_of_movie=input("type of movie u want:")


v_movie_name=input("enter movie name:")

print("details uploaded")

V_SQL_INSERT1="insert into cd_details


values("+str(v_year_of_release)+",'"+v_type_of_movie+"','"+v_movie_name+"','"+v_lang
uage+"')"
c1.execute(V_SQL_INSERT1)

print("movie added to your cart")

conn.commit()

if choice2==6:

v_dvd_model=input("enter dvd model:")

v_dvd_name=input("enter dvd company:")

v_version=int(input("enter the version you need:"))

v_range_of_amt=int(input("the amt of product u expect:"))

if v_range_of_amt>=5000:

print("best products awaits you")

else:

print("we can provide the best if there is offers")

V_SQL_INSERT2="insert into dvd_detail


values('"+v_dvd_model+"','"+v_dvd_name+"',"+str(v_version)+","+str(v_range_of_amt)+
")"
c1.execute(V_SQL_INSERT2)

print("dvd added to your cart !!!")

conn.commit()

if choice2==4:

v_customer_name=input("enter name:")

print("welcome",v_customer_name,"to our shop")

v_age=int(input("enter ur age:"))

v_mobile_number=int(input("enter ur phno:"))
v_cd_or_dvd=input("enter what you want(cd or dvd):")

if v_cd_or_dvd=="cd":

v_year_of_release=int(input("enter the year:"))

v_language=input("enter ur language:")

print("1.horror")

print("2.comedy")

print("3.action")

print("4.inspiration")

print("5.sentimental")

v_type_of_movie=input("type of movie u want:")

v_movie_name=input("enter movie name:")

print("details uploaded")

V_SQL_INSERT1="insert into cd_details


values("+str(v_year_of_release)+",'"+v_type_of_movie+"','"+v_movie_name+"','"+v_lang
uage+"')"

c1.execute(V_SQL_INSERT1)

print("movie added to your cart")

conn.commit()
elif v_cd_or_dvd=="dvd":
v_dvd_model=input("enter dvd model:")

v_dvd_name=input("enter dvd name:")

v_version=int(input("enter the version you need:"))

v_range_of_amt=int(input("the amt of product u expect:"))

if v_range_of_amt>=10000:

print("best products awaits you")

else:

print("we can provide the best if there is offers")


V_SQL_INSERT2="insert into dvd_detail
values('"+v_dvd_model+"','"+v_dvd_name+"',"+str(v_version)+","+str(v_range_of_amt)+
")"

c1.execute(V_SQL_INSERT2)

print("dvd added to your cart !!!")


conn.commit()

else:

print("sorry we didn't get u")

v_rating=int(input("rate us if u like:"))

V_SQL_INSERT1="insert into online


values('"+v_customer_name+"',"+str(v_age)+","+str(v_mobile_number)+",'"+v_cd_or_dv
d+"',"+str(v_rating)+")"
c1.execute(V_SQL_INSERT1)

conn.commit()

print("your order will accpected once u detail ur material")

if choice==2:

print('to create your account please enter your user id and password')

c1=conn.cursor()

#c1=conn.cursor("('create table login_id(user_id varchar(100) primary key,passwd


varchar(100),name varchar(100))')

v_user_id=int(input("choose your user id (in integer):"))


print('')

v_passwd=int(input("create your password (in integer):"))

print('')

v_name=input("your full name:")

print('')

c1=conn.cursor()

update="insert into login_id values("+ str(v_user_id) +","+ str(v_passwd) +",'"+ v_name


+"')"

c1.execute(update)

conn.commit()

print("account created")

if choice==3:

print("THANK YOU",n)

print("VISIT AGAIN")

from time import gmtime,strftime

a=strftime("%a,%d%b%y",gmtime())

print(a)

You might also like