You are on page 1of 16

INDEX

Sr. Particulars Page


No.

1 Project Analysis 4

2 Functions and 5
Modules

3 Detailed Description 6

4 Source Code 7

5 How its work 11


PROJECT ANALYSIS

Our application program is specially


designed for Our School to Teacher
Duty Management System. Our program
work is to manageTeacherduty
system . Manage teacher duty provide
to members .
We have used PYTHON and MYSQL as
ourplatform to carry out this task.
FUNCTIONS AND
MODULES
Module:

Import mysql.connector

By importing this package, we are able to establish the


connectionbetween SQL and Python.

FUNCTIONS:

Connect(): The connect() constructor creates a connection to


theMySQL server and returns a MySQL Connection object.

Cursor(): A MySQL cursor is an object that is used to


process datareturned by an SQL query, one row at a time.

Execute(): After preparing a statement with PREPARE , you


execute itwith an EXECUTE statement that refers to the
prepared statement name.

Def(): Define a function with the def keyword, then write the
functionidentifier (name) followed by parentheses and a
colon.

Fetchall(): Fetches all (or all remaining) rows of a query result


set andreturns a list of tuples.

Fetchmany(): This method fetches the next set of rows of


a queryresult and returns a list of tuples.

Commit(): This method sends a COMMIT statement to the


MySQLserver, committing the current transaction.
DETAILED DESCRIPTION
 Our Project has 1 MySQL tables. This is: -

1. Teacher

1) The Table teacher contain the following columns:

a) Serial_No

b) Name

c) Subject

d) C_teacher

e) Co-teacher

f) h_master

g) ah_master

h) club
SOURCE CODE

FOR PYTHON :
def add_teacher():
print(o*38,'ADD TEACHER RECORD',o*38)
serial_no=int(input("enter serial no"))
name=input("enter name")
sub=input("enter subject teach")
c_teacher=input("which class classteacher")
co_teacher=input("which class co class teacher")
h_master=input("enter which house hm")
ah_master=input("enter which house ahm")
club=input("enter club name")
data=(serial_no,name,sub,c_teacher,co_teacher,h_master,ah_master,club)
sql='insert into teacher values(%s,%s,%s,%s,%s,%s,%s,%s)'
c=b.cursor()
c.execute(sql,data)
r=c.fetchall()
b.commit()
print("successfully added teacher record")
print(o*38,'SUCCESSFULLY ADDED RECORD',o*38)

def dsply_tchr():
print(o*38,'DISPLAY RECORD',o*38)
c=b.cursor()
c.execute('select * from teacher')
r=c.fetchall()
with open('myfile.txt','w')as f:
for i in r:
f.write(','.join(str(s)for s in i)+'\n')
for i in r:
print(o*50)
print("serial_no ",i[0])
print("name ",i[1])
print("subject ",i[2])
print("class ",i[3])
print("co class ",i[4])
print("house ",i[5])
print("ahm house ",i[6])
print("club ",i[7])
print(o*50)
print(o*38,'SUCCESSFULLY DISPLAYED RECORD',o*38)
def update_tchr():
print(o*38,'UPDATE TEACHER RECORD',o*38)
print('1. to update serial_no')
print('2. to update name')
print('3. to update sub')
print('4. to update class')
print('5. to update class of co')
print('6. to update house')
print('7. to update house of ahm')
print('8. to update club')
print(o*38,'ENTER CHOICE',o*38)
a=int(input('enter your choices: '))
if a==1:
show1()
elif a==2:
show2()
elif a==3:
show3()
elif a==4:
show4()
elif a==5:
show5()
elif a==6:
show6()
elif a==7:
show7()
def show1():
serial_no=input('enter sr_no')
x= input("enter new sr_no : ")
z=(x,serial_no)
sql="update teacher set serial_no=%s where serial_no= %s"
c=b.cursor()
c.execute(sql,z)
b.commit()
print("update teacher record")
print(o*38,'SUCCESSFULL UPDATE SERIAL NO.',o*38)
def show2():
name=input('enter name')
x= input("enter new name : ")
z=(x,name)
sql="update teacher set name=%s where name= %s"
c=b.cursor()
c.execute(sql,z)
b.commit()
print("update teacher record")
print(o*38,'SUCCESSFULL UPDATE NAME',o*38)
def show3():
sub=input('enter sub name')
x= input("enter new sub: ")
z=(x,sub)
sql="update teacher set sub=%s where sub= %s"
ud=(x,z)
c=b.cursor()
c.execute(sql,z)
b.commit()
print("update teacher record")
print(o*38,'SUCCESSFULL UPDATE SUBJECT',o*38)
def show4():
clas=input('enter class name')
x= int(input("enter new class: "))
z=(x,clas)
sql="update teacher set clas=%s where class= %s"
ud=(x,z)
c=b.cursor()
c.execute(sql,z)
b.commit()
print("update teacher record")
print(o*38,'SUCCESSFULL UPDATE CLS OF TEACHER',o*38)
def show5():
co=input('enter co class name')
x= input("enter new co class: ")
z=(x,co)
sql="update teacher set co=%s where co_teacher= %s"
ud=(x,z)
c=b.cursor()
c.execute(sql,z)
b.commit()
print("update teacher record")
print(o*38,'SUCCESSFULL UPDATE CO CLS OF TCHR',o*38)
def show6():
h=input('enter house name')
x= input("enter new house: ")
z=(x,h)
sql="update teacher set h=%s where h_master= %s"
ud=(x,z)
c=b.cursor()
c.execute(sql,z)
b.commit()
print("update teacher record")
print(o*38,'SUCCESSFULL UPDATE TEACHER HOUSE',o*38)
def show7():
ah=input('enter house name of ahm')
x= input("enter new housename: ")
z=(x,ah)
sql="update teacher set ah=%s where ah_master= %s"
ud=(x,z)
c=b.cursor()
c.execute(sql,z)
b.commit()
print("update teacher record")
print(o*38,'SUCCESSFULL UPDATE TEACHER HOUSE FOR AHM',o*38)
def show8():
club=input('enter club name')
x= input("enter new club: ")
z=(x,club)
sql="update teacher set club=%s where club= %s"
ud=(x,z)
c=b.cursor()
c.execute(sql,z)
b.commit()
print("update teacher record")
print(o*38,'SUCCESSFULL UPDATE CLUB',o*38)

def search_tchr():
print(o*38,'SEARCHED RECORD',o*38)
c=b.cursor()
x=int(input("enter serial no"))
sql="select * from teacher where serial_no=%s"%(x)
c.execute(sql)
r=c.fetchall()
count=c.rowcount
for i in r:
print("serial_no ",i[0])
print("name ",i[1])
print("subject ",i[2])
print("class ",i[3])
print("co class ",i[4])
print("house ",i[5])
print("ahm house ",i[6])
print("club ",i[7])
print("record searched")
print(o*38,'SUCCESSFULL SEARCHED RECORD',o*38)

def delete_tchr():
print(o*38,'DELETE TCHR RECORD',o*38)
c=b.cursor()
dlt=input("enter name to delete data")
dlt=(dlt,)
r="delete from teacher where name=%s"
c.execute(r,dlt)
b.commit()
print("delete data successfully")
print(o*38,'SUCCESSFULLY DELETED RECOARD',o*38)

import mysql.connector as a
b=a.connect(host='localhost',user='root',password='admin',database='schoo
l')
o="="
print(o*42,'TEACHER DUTY MANAGMENT',o*42)
def menu():
cs='y'
while cs=='y':
print('1. add teacher data')
print('2. display teacher data')
print('3. modifiy teacher data')
print('4. search teacher data')
print('5. delete teacher data')
print('6. exit\n')
cho=int(input('enter a choices: '))
if cho==1:
add_teacher()
elif cho==2:
dsply_tchr()
elif cho==3:
update_tchr()
elif cho==4:
search_tchr()
elif cho==5:
delete_tchr()
elif cho==6:
print('thank you')
print('exiting')
print(o*38,'THANK YOU',o*38)
break
else:
print('wrong input taken')
menu()

==================== TEACHER DUTY MANAGMENT ===================


1. add teacher data
2. display teacher data
3. modifiy teacher data
4. search teacher data
5. delete teacher data
6. exit

enter a choices: 1
===================== ADD TEACHER RECORD ======================
enter serial no 16
enter name ankit
enter subject teach science
which class classteacher 11
which class co class teacher null
enter which house hm shiwalik junior
enter which house ahm null
enter club name science
successfully added teacher record
===================== SUCCESSFULLY ADDED RECORD ===============
1. add teacher data
2. display teacher data
3. modifiy teacher data
4. search teacher data
5. delete teacher data
6. exit

enter a choices: 2
======================== DISPLAY RECORD =======================
==================================================
serial_no : 1
name : satbir singh
subject : biology
class : null
co class : 12
house : shiwalik senior
ahm house : null
club : eco
==================================================
==================================================
serial_no : 10
name : pappu singh
subject : hindi
class : 9th A
co class : null
house : shiwalik senior
ahm house : null
club : hindi
==================================================
==================================================
serial_no : 12
name : mukesh rathi
subject : sst
class : null
co class : null
house : nilgiri senior
ahm house : null
club : civics
==================================================
==================================================
serial_no : 15
name : ankit
subject : science
class : 8th
co class : null
house : shiwalik junior
ahm house : null
club : science
==================================================
==================================================
serial_no : 16
name : ankit
subject : science
class : 11
co class : null
house : shiwalik junior
ahm house : null
club : science
==================================================
==================================================
serial_no : 2
name : satyabhan
subject : cs
class : 12
co class : null
house : null
ahm house : arawali senior
club : IT
==================================================
==================================================
serial_no : 23
name : g
subject : hfg
class : ghfh
co class : 11
house : ghgh
ahm house : fgfd
club : gh
==================================================
==================================================
serial_no : 3
name : kc kamal
subject : physical
class : null
co class : null
house : null
ahm house : shiwalik senior
club : sports
==================================================
==================================================
serial_no : 5
name : adarsh
subject : physics
class : null
co class : null
house : udaigiri senior
ahm house : null
club : astronomy
==================================================
==================================================
serial_no : 6
name : sunil
subject : sst
class : null
co class : null
house : null
ahm house : udaigiri senior
club : civics
==================================================
==================================================
serial_no : 7
name : annu arya
subject : chem
class : null
co class : null
house : udaigiri senior
ahm house : null
club : science
==================================================
==================================================
serial_no : 9
name : mahesh saini
subject : maths
class : null
co class : 12th comm
house : nilgiri senior
ahm house : null
club : maths
==================================================
================ SUCCESSFULLY DISPLAYED RECORD ================
1. add teacher data
2. display teacher data
3. modifiy teacher data
4. search teacher data
5. delete teacher data
6. exit

enter a choices: 3
================ UPDATE TEACHER RECORD ================
1. to update serial_no
2. to update name
3. to update sub
4. to update class
5. to update class of co
6. to update house
7. to update house of ahm
8. to update club
============================= ENTER CHOICE ==============================
enter your choices: 2
enter name :ankit
enter new name : Ankit
update teacher record
========================= SUCCESSFULL UPDATE NAME =======================
1. add teacher data
2. display teacher data
3. modifiy teacher data
4. search teacher data
5. delete teacher data
6. exit

enter a choices: 4
=================== SEARCHED RECORD ===================
enter serial no 5
serial_no 5
name adarsh
subject physics
class null
co class null
house udaigiri senior
ahm house null
club astronomy
record searched
======================= SUCCESSFULL SEARCHED RECORD =====================
1. add teacher data
2. display teacher data
3. modifiy teacher data
4. search teacher data
5. delete teacher data
6. exit

enter a choices: 5
================== DELETE TCHR RECORD =================
enter name to delete data pradeep
delete data successfully
===================== SUCCESSFULLY DELETED RECOARD ======================
1. add teacher data
2. display teacher data
3. modifiy teacher data
4. search teacher data
5. delete teacher data
6. exit

enter a choices: 6
thank you
exiting
====================== THANK YOU ======================

You might also like