Import Mysq1123
Import Mysq1123
Import Mysq1123
connector
def get_int_input(prompt):
while True:
try:
return int(input(prompt))
except ValueError:
def read_file(filename):
if os.path.exists(filename):
data = f.read()
print(data)
else:
def connect_to_database():
try:
con = mysql.connector.connect(
host='localhost',
password='jay8811',
user='root',
database='store'
)
if con.is_connected():
print('Successfully connected')
c = con.cursor()
print('1. Login')
print('2. Exit')
if choice == 1:
print('Connected successfully')
while True:
print('10. Stocks')
if choice == 1:
elif choice == 2:
elif choice == 3:
elif choice == 4:
display_all_customer_details(c)
elif choice == 5:
display_all_product_details(c)
elif choice == 6:
display_all_worker_details(c)
elif choice == 7:
display_one_customer_detail(c, name)
elif choice == 8:
elif choice == 9:
display_one_worker_detail(c, name)
print('**************')
read_file('test.txt')
print('**************')
display_stock_pie_chart()
elif choice == 2:
print("Exiting...")
else:
else:
print("Invalid username or password.")
elif choice == 2:
print("Exiting...")
print(f"Error: {err}")
finally:
if con.is_connected():
con.close()
sql_insert = "INSERT INTO customer_details (phone_no, cust_name, cost) VALUES (%s, %s, %s)"
c.connection.commit()
c.connection.commit()
c.connection.commit()
def display_all_customer_details(c):
records = c.fetchall()
print(record)
def display_all_product_details(c):
records = c.fetchall()
print(record)
def display_all_worker_details(c):
records = c.fetchall()
print(record)
records = c.fetchall()
print(record)
records = c.fetchall()
print(record)
records = c.fetchall()
print(record)
def display_stock_pie_chart():
plt.show()
# Entry point for the application
if '_name_' == '_main_':
connect_to_database()