Skip to content

Commit d778cbd

Browse files
committed
added new method (temporary commit)
1 parent bee5139 commit d778cbd

File tree

1 file changed

+42
-0
lines changed

1 file changed

+42
-0
lines changed

editemployee.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import mysql.connector
2+
import pickle
3+
4+
cred = open("cred.dat","rb")
5+
dat=pickle.load(cred)
6+
cred.close()
7+
Passwo=dat[0]
8+
Databa=dat[1]
9+
conn=mysql.connector.connect(host="localhost",user="root",password=Passwo,database=Databa)
10+
cur=conn.cursor()
11+
12+
def ap3():
13+
print("---------Edit employee process----------\n")
14+
while True:
15+
emp_no=input(("Enter emp_no of the employee to edit the details: "))
16+
if len(emp_no) <= 5:
17+
try:
18+
emp_no=int(emp_no)
19+
print("Checking...")
20+
except ValueError:
21+
print("emp_no should be an integer!!")
22+
else:
23+
break
24+
else:
25+
print("Maximum length is 5!")
26+
cur.execute("select * from employees where emp_no={}".format(emp_no))
27+
results=cur.fetchall()
28+
if results == []:
29+
print("That employee number does not exist.")
30+
else:
31+
print(results)
32+
ap3()
33+
34+
def f2():
35+
print("1.emp_no")
36+
print("2.birth_date")
37+
print("3.first_name")
38+
print("4.last-name")
39+
print("5.gender")
40+
print("6.hire_date")
41+
print("0 to quit.")
42+
a=input("What would you like to change from the above:")

0 commit comments

Comments
 (0)