SOURCE CODE
SOURCE CODE
CODE
import mysql.connector
mydb=mysql.connector.connect (host="local
host",user="AADARSH",password="@2024-25")
mycursor=mydb.cursor()
mycursor.execute("use store")
varchar(20),password varchar(20)")
while True :
print("\n\n===========***************** WELCOME TO
*****************===========""")
*****************============""")
ch=int(input("SIGNUP/LOGIN(1,2):"))
#SIGNUP
if ch==1:
username=input("USERNAME:")
password=int(input("PASSWORD:"))
values('"+username+"','"+password+"')")
mydb.commit()
#LOGIN
elif ch==2:
username=input("USERNAME: ")
password=int(input("PASSWORD: "))
(username,))
pot = mycursor.fetchall()
print("VALID USERNAME!!!!!")
%s",(password,))
a= mycursor.fetchall()
if a is not None:
print("""+++++++++++++++++++++++++++++++++LOGIN
SUCCESSFULL++++++++++++++++++++++++++++++++++++++++""")
a=mycursor.fetchall()
int(4)")
int(200)")
mydb.commit()
a=mycursor.fetchall()
while(True):
#ADD BOOKS
if a==1:
mandatory to be filled\n")
genre=str(input("Genre:"))
quantity=int(input("Enter Quantity:"))
author=str(input("Enter Author
Name :"))
publication=str(input("Enter
Publication House:"))
mycursor.execute("select * from
row=mycursor.fetchone()
mycursor.execute("update
bookname ='"+book+"'")
mydb.commit()
print("""++++++++++++++++++++++++++
++++++++SUCCESSFULLY ADDED++++++++++++++++++++++++++++++++++++++++++++
+""")
else:
mycursor.execute("insert into
Available_Book(bookname,genre,quantity,author,publication,price)
values('"+book+"','"+genre+"','"+str(quantity)
+"','"+author+"','"+publication+"','"+str(price)+"'")
mydb.commit()
print("""++++++++++++++++++++++++++
++++++++SUCCESSFULLY ADDED++++++++++++++++++++++++++++++++++++++++++++
+""")
#SELL BOOKS
elif a==2:
print("Available Books.....")
mycursor.execute("select * from
Available_Books")
for x in mycursor:
print(x)
cusname=str(input("Enter customer
name:"))
n=int(input("Enter quantity:"))
amt=price*n
root=mycursor.fetchone()
if max(root)<n:
available!!!!")
else:
mycursor.execute("select bookname
log=mycursor.fetchone()
if log is not None:
mycursor.execute("insert into
Sell_rec values('"+cusname+"','"+str(phno)+"','"+book+"','"+str(price)
+"','"+str(n)+"','"+str(amt)+"')")
mycursor.execute("update
bookname='"+book+"'")
mydb.commit()
print("""++++++++++++++++++++++++
+++++""")
else:
print("BOOK ISNAT
AVAILABLE !!!!!!!")
elif a==3:
l=int(input("Search by?:"))
#BY BOOKNAME
if l==1:
mycursor.execute("select bookname
tree=mycursor.fetchone()
if tree!=None:
print("""++++++++++++++++++++++++
++++++""")
else:
print("BOOK IS NOT IN
STOCK!!!!!!!!!!!!!!!!!")
#BY GENRE
elif l==2:
print("""++++++++++++++++++++++++
++++++""")
mycursor.execute("select * from
for y in mycursor:
print(y)
else:
print("BOOK IS NOT IN
STOCK!!!!!!!!!!!!!!!!!")
#BY AUTHOR
elif l==3:
home=mycursor.fetchone()
if home is not None:
print("""++++++++++++++++++++++++
++++++""")
mycursor.execute("select * from
for z in mycursor:
print(z)
else:
print("BOOK IS NOT IN
STOCK!!!!!!!!!!!!!!!!!")
mydb.commit()
#SELL HISTORY
elif a==4:
print("1:Sellhistory details")
mycusor.execute("select * from
Sell_Rec")
for u in mycursor:
print(u)
if ty==2:
if bb=="Y":
mycursor.execute("delete from
Sell_Rec")
mydb.commit()
elif bb=="N":
pass
#AVAILABLE BOOKS
elif a==5:
mycursor.execute("select * from
for v in mycursor:
print(v)
mycursor.execute("SELECT
total_income = mycursor.fetchone()[0]
(total_income)")
#EXIT
elif a==7:
print("\nThank You")
break
break
else:
print("""+++++++++++++++++++++++++++++++++
else:
print("""+++++++++++++++++++++++++++++++++++++++++
else:
break
OUTPUT