0% found this document useful (0 votes)
13 views

alumni-management-system-python-corrected (1)

Uploaded by

vineetsingh54320
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views

alumni-management-system-python-corrected (1)

Uploaded by

vineetsingh54320
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

import mysql.

connector

# Connect to the database

constr = mysql.connector.connect(

host="localhost",

user="root",

passwd="",

database="aldb"

print(constr)

mycursor = constr.cursor()

# Register Alumni Function

def RegisterAlumni():

L = []

fname = input("Enter Your First Name: ")

L.append(fname)

lname = input("Enter Your Last Name: ")

L.append(lname)

dob = input("Enter DOB in YYYY-MM-DD Format: ")

L.append(dob)

gender = input("Enter Your Gender: ")

L.append(gender)

add_c = input("Enter your correspondence address: ")

L.append(add_c)
add_of = input("Enter your official address: ")

L.append(add_of)

email = input("Enter your email address (e.g., [email protected]): ")

L.append(email)

mob = input("Enter Your Mobile No: ")

L.append(mob)

cur_c = input("Enter City Name You Stay: ")

L.append(cur_c)

com = input("Enter Company/Organization You are Working: ")

L.append(com)

desg = input("Enter Your Designation in Company/Organization: ")

L.append(desg)

start_y = input("Enter Your Session Start Year in College: ")

L.append(start_y)

start_e = input("Enter Your Session End Year in College: ")

L.append(start_e)

branch = input("Enter Your Branch in College: ")

L.append(branch)

# Generate Alumni ID

alid = "al" + fname[0:2] + lname[0:2] + mob[0:4]

L.insert(0, alid)

alumni = tuple(L)

sql = (

"insert into alureg (alu_id, first_name, last_name, dob, gender, add_corr, add_offc, em

"curr_city, curr_company, desg, session_from, session_to, branch) "


"values (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"

mycursor.execute(sql, alumni)

constr.commit()

print("You Have Been Successfully Registered! This is Your Alumni ID: ", alid)

# Other functions (ViewAlumniDetails, EditAlumni, DeleteAlumni, etc.) can be defined similarly

# with proper indentation and formatting for readability.

You might also like