import mysql.connector connection = mysql.connector.connect( host = "localhost", user = "root", password = "password", database = "python" ) name = input("Enter Name to search for:") cursor = connection.cursor() cursor.execute("SELECT * FROM contacts") records = cursor.fetchall() fetched = False for record in records: if record[1] == name: print(f"ID: {record[0]}, Name: {record[1]}, Email: {record[2]}") fetched = True if not fetched: print(f"Record {name} not found.") cursor.close() connection.close()