Source Code PDF
Source Code PDF
Source Code PDF
#LOG.PY
import mysql.connector
db=input("ENTER NAME OF THE DATABASE{YOU HAVE OR U WANT
TO CREATE}: ")
mydb=mysql.connector.connect(host='localhost',
user='root',passwd='faisalshmm')
mycursor=mydb.cursor()
elif n==2 :
name=input('Enter your Username='.upper())
passwd=int(input('Enter your 4 DIGIT Password='.upper()))
V_Sql_Sel="select * from user_table where passwrd='"+str
(passwd)+"' and username= ' " +name+ " ' "
mycursor=mydb.cursor()
mycursor.execute(V_Sql_Sel)
print("You are Signed in!!!".upper())
import main
import mysql.connector as c
db=input("DO YOU HAVE A DATABASE? (y/n)")
dname=" "
mydb= " "
mycursor= " "
if(db=='n'):
dname=input("ENTER NEW DATABASE NAME U WANT TO
CREATE=")
mydb=c.connect(host='localhost',user='root',password='faisalshmm')
mycursor=mydb.cursor()
mycursor.execute("create database "+dname)
mydb=c.connect(host='localhost',user='root',password='faisalshmm',data
base=dname)
mycursor=mydb.cursor()
mycursor.execute("Create Table if not exists customer_details\
(ACCNO INT(3) PRIMARY KEY,\
NAME VARCHAR(25) NOT NULL,\
MOBILE BIGINT(11) CHECK(MOBILE>11),\
AGE INT(3),\
GENDER CHAR(10),\
ADDRESS VARCHAR(30),\
CITY CHAR(15),\
BALANCE FLOAT(10))")
else:
mydb=c.connect(host='localhost',user='root',password='faisalshmm',data
base=dname)
mycursor=mydb.cursor()
mycursor.execute("Create Table if not exists customer_details\
(ACCNO INT(3) PRIMARY KEY,\
NAME VARCHAR(25) NOT NULL,\
MOBILE BIGINT(11) CHECK(MOBILE>11),\
AGE INT(3),\
GENDER CHAR(10),\
ADDRESS VARCHAR(30),\
CITY CHAR(15),\
BALANCE FLOAT(10))")
while True:
print('--'*120)
print("=================WELCOME TO BANKING
MANAGEMENT SYSTEM================".center(140))
print("--"*120)
print("1. CREATE NEW ACCOUNT")
print("2. DISPLAY RECORDS AS PER ACCOUNT NUMBER")
print(" a. Sorted as per Account Number".upper())
print(" b. Sorted as per Account Holder Name".upper())
print(" c. Sorted as per Customer Balance".upper())
print("3. All Account holder list".upper())
print("4. Search Record Details as per Account Number". Upper())
print("5. Update Record".upper())
print("6. Delete Record".upper())
print("7. Transaction".upper())
print(" a. Withdraw Money".upper())
print(" b. Deposit Money".upper())
print("8. Exit".upper())
Rec=(ACCNO,NAME.upper(),MOBILE,AGE,GENDER.upper(),ADDRES
S.upper(),CITY.upper(),BALANCE)
mycursor=mydb.cursor()
cmd= ("INSERT INTO customer_details values ('{}', '{}', '{}', '{}',
'{}','{}','{}'
,'{}');".format(ACCNO,NAME,MOBILE,AGE,GENDER,ADDRESS,CITY,B
ALANCE))
mycursor.execute(cmd)
mydb.commit()
print("Record Saved".upper())
print(F%("ACCNO","NAME","MOBILE","AGE","GENDER","ADDRESS","
CITY","BALANCE"))
print('='*125)
for i in mycursor:
for j in i:
print("%14s"%j, end=' ')
print()
print('='*125)
print(F%("ACCNO","NAME","MOBILE","AGE","GENDER","ADDRESS","
CITY","BALANCE"))
print('='*125)
for i in mycursor:
for j in i:
print("%14s"%j, end=' ')
print()
print('='*125)
elif ch1=='d' or ch1=='D':
continue
print(F%("ACCNO","NAME","MOBILE","AGE","GENDER","ADDRESS","
CITY","BALANCE"))
print('='*125)
for i in mycursor:
for j in i:
print("%14s"%j, end=' ')
print()
print('='*125)
print(F%("ACCNO","NAME","MOBILE","AGE","GENDER","ADDRESS","
CITY","BALANCE"))
print('='*125)
for j in i:
print('%14s' %j, end=' ')
print()
print('='*125)
break
else:
print("Record not found".upper())
elif(choice==6):#Delete section
mycursor=mydb.cursor()
print('*'*100)
print('-----YOU ARE IN DELETING SECTION----')
A=int(input('Enter the Account Number whose details are to be
deleted:-'))
cmd="DELETE FROM customer_details WHERE ACCNO="+str(A)
mycursor.execute(cmd)
mydb.commit()
c=mycursor.rowcount
if c>0:
print("RECORD HAS BEEN DELETED")
else:
print("ACCOUNT NUMBER: "+str(A)+" IS NOT FOUND")
print("NO CHANGE HAS BEEN MADE")
elif(choice==7):#Transaction section
print('*'*100)
print('-------YOU ARE IN TRANSACTION SECTION-----')
ch2=input("Enter choice a/b/c/:-".upper())
if ch2=='a' or ch2=='A':
mycursor=mydb.cursor()
mycursor.execute("select * from customer_details")
S=mycursor.fetchall()
print("Please Note that money can only be debited if min balance
of Rs 3000 exist".upper())
acc=int(input("Enter Account Number whose money is to be
debited:-".upper()))
for i in S:
i=list(i)
if i[0]==acc:
Amt=float(input('Enter amount to be debited:-'.upper()))
if i[7]-Amt>=3000:
i[7]-=Amt
cmd="Update customer_details set BALANCE=%s
WHERE ACCNO=%s"
val=(i[7],i[0])
mycursor.execute(cmd,val)
mydb.commit()
print("Amount Debited".upper())
break
else:
print("There must be a min balance of Rs 3000".upper())
continue
elif choice==8:#End
print("Thank you for using our banking system!".upper())
print("God Bless".upper())
print("Exiting..............".upper())
break