Abinav Vijay PDF
Abinav Vijay PDF
The “Contact Management System” has been developed to override the problems
prevailing in the practicing manual system. This software is supported to eliminate
and in some cases reduce the hardships faced by this existing system. Moreover,
this system is designed for the particular need of the company to carry out
operations in a smooth and effective manner.
The application is reduced as much as possible to avoid errors while entering the
data. It also provides error message while entering invalid data. No formal
knowledge is needed for the user to use this system. Thus by this all it proves it is
user-friendly. Contact Management System, as described above can lead to error
free, secure, reliable and fast management system. It can assist the user to
concentrate on their other activities rather to concentrate on the record keeping.
Thus it will help organization in better utilization of resources.
1
FRONT END: PYTHON
BACK END :MYSQL
PYTHON:
Python is an interpreted, object-oriented, high-level programming language with
dynamic semantics developed by Guido van Rossum. It was originally released in
1991. Designed to be easy as well as fun, the name "Python" is a nod to the British
comedy group Monty Python. Python has a reputation as a beginner-friendly
language, replacing Java as the most widely used introductory language because it
handles much of the complexity for the user, allowing beginners to focus on fully
grasping programming concepts rather than minute details.
2
MYSQL:
MySQL is a SQL-based relational database management system for web databases.
Use MySQL for various applications, including data cleansing, data warehousing,
online shopping, logging software, and portals. MySQL can store everything from
a single record to a complete product inventory. The application of MySQL varies
based on the need. It can associate with any scripting language like PHP or Perl
and create websites.
3
Source Code:
import os
import platform
import mysql.connector
mydb=mysql.connector.connect(host="localhost",user="root",passwd="admin",dat
abase="contact")
mycursor=mydb.cursor()
mycursor.execute("create table contact_book(mobile_no bigint,name
varchar(20),address varchar(30),email varchar(30));")
mycursor.execute("insert into contact_book values(7898983890,'Varshini','KRK
Street','vars@gmail.com');")
mycursor.execute("insert into contact_book values(6787967388,'Bharathi','Sai
Street','Bharat@gmail.com');")
mycursor.execute("insert into contact_book values(9878638895,'Sankar','Durgai
Street','San@gmail.com');")
mydb.commit()
def display():
mycursor.execute("select * from contact_book;")
data=mycursor.fetchall()
for i in data:
print(i)
def add_contact():
L=[]
mobile_no=input("Enter Moobile number(10 Digits): ")
L.append(mobile_no)
4
name=input("Enter the Name : ")
L.append(name)
address=input("Enter address : ")
L.append(address)
email=input("Enter the email : ")
L.append(email)
cont=(L)
sql="insert into contact_book(mobile_no,name,address,email) values
(%s,%s,%s,%s)"
mycursor.execute(sql,cont)
mydb.commit()
def view_contact():
print("Select the search criteria : ")
print("1. Mobile_no")
print("2. Name")
print("3. Address")
print("4. email")
print("5. All contacts")
ch=int(input("Enter the choice : "))
if (ch==1):
s=input("Enter mobile Nummber : ")
rl=(s,)
sql="select * from contact_book where mobile_no=%s"
mycursor.execute(sql,rl)
5
elif (ch==2):
nm=input("Enter Name : ")
rl=(nm,)
sql="select * from contact_book where name='%s';"%nm
mycursor.execute(sql)
elif (ch==3):
s=input("Enter address : ")
rl=(s,)
sql="select * from contact_book where address=%s;"
mycursor.execute(sql,rl)
elif (ch==4):
s=input("Enter email : ")
rl=(s,)
sql="select * from contact_book where email=%s;"
mycursor.execute(sql,rl)
elif (ch==5):
sql="select * from contact_book;"
mycursor.execute(sql)
res=mycursor.fetchall()
print("The contact details are as follows : ")
6
def search_contact():
name=input("Enter name to search:")
mycursor.execute("select * from contact_book where name='%s'"%(name))
data=mycursor.fetchall()
for i in data:
print(i)
def del_contact():
name=input("Enter the name to be deleted : ")
rl=(name,)
sql="delete from contact_book where name=%s"
mycursor.execute(sql,rl)
mydb.commit()
def Main_Menu():
print("Enter 1 : TO ADD NEW CONTACT")
print("Enter 2 : TO VIEW CONTACT ")
print("Enter 3 : TO SEARCH CONTACT ")
print("Enter 4 : TO DELETE CONTACT")
print("Enter 5: TO DISPLAY CONTACTS ")
try: #Using Exceptions For Validation
userInput = int(input("Please Select An Above Option: ")) #Will Take Input
From User
except ValueError:
exit("\nHy! That's Not A Number") #Error Message
else:
7
print("\n") #Print New Line
if(userInput==1):
add_contact()
elif (userInput==2):
view_contact()
elif (userInput==3):
search_contact()
elif (userInput==4):
del_contact()
elif (userInput==5):
display()
else:
print("Enter correct choice. . . ")
Main_Menu()
8
Python Output:
9
10
11
12
MySQL Output:
13
14
15