the MBA has a new look for 2025
We have so many great happenings in 2025 for our
local businsesses and the community.
import sqlite3
# Path to the database
db_file = 'business_directory.db'
def search_database():
print("Welcome to the Business Directory Search")
print("Search Options:")
print("1. Business Name")
print("2. Category")
print("3. Business Type")
choice = input("Enter the number of your search choice (1/2/3): ")
# Map choices to database columns
column_map = {
"1": "business_name",
"2": "category",
"3": "business_type"
}
column = column_map.get(choice)
if not column:
print("Invalid choice. Exiting search.")
return
search_term = input(f"Enter the search term for {column.replace('_', ' ').title()}: ")
# Connect to the database and perform the search
conn = sqlite3.connect(db_file)
cursor = conn.cursor()
query = f"SELECT * FROM BusinessDirectory WHERE {column} LIKE ?"
cursor.execute(query, (f"%{search_term}%",))
results = cursor.fetchall()
conn.close()
# Display the results
if results:
print(f"\nFound {len(results)} matching results:\n")
for result in results:
print("ID:", result[0])
print("Business Name:", result[1])
print("Category:", result[2])
print("Business Type:", result[3])
print("Website:", result[4])
print("Email:", result[5])
print("Phone:", result[6])
print("Established Year:", result[7])
print("Logo Path:", result[8])
print("-" * 40)
else:
print("\nNo matching results found.")
if __name__ == "__main__":
search_database()
Business Name |
First Name |
Last Name |
Website |
Email |
Phone |
Established |
Category |
Business Type |
1785 Farm Dog |
Stephanie |
Yekenchik |
6096780414 |
2023 |
Life & Leisure, Taste of Medford, |
Restaurant/Taverns, Food/Food Trucks |
||
Value |
||||||||
Value |
||||||||
Value |
||||||||