I am working with Python and MySQL in a Tkinter application. I'm trying to do a search filter to only show me the entries in my table that correspond to what I entered with the keyboard but I do not know how to set it in the SQL statement.
The function I'm using for it is:
def buscar(): conn = MySQLdb.connect(host = "127.0.0.1", user = "root", passwd = "unitec", db = "efrias002") cursor = conn.cursor() cursor.execute("SELECT * FROM base17 WHERE usuario = 'fduran006'") data = cursor.fetchall() for item in data: list1.insert(END,item) conn.close()
In this case the previous sentence will search in the field "user" everything that contains "fduran006" but how can I modify it so that it looks for what I indicate by means of keyboard. How should I modify the% share% share to achieve this?