Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/56.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 将数据从数据库显示到tkinter不工作_Python_Mysql_Tkinter - Fatal编程技术网

Python 将数据从数据库显示到tkinter不工作

Python 将数据从数据库显示到tkinter不工作,python,mysql,tkinter,Python,Mysql,Tkinter,我在这里定义了一个函数,它应该可以正常工作,因为我在其他地方使用了一个类似的函数,但没有给出任何条件(where..like或regexp),它在那里工作得很好,当我使用regexp时,它没有给出任何输出。为什么呢?提前感谢:) 代码: 有时我也会遇到此错误UnboundLocalError:赋值前引用的局部变量“index”SELECT语句的语法不正确: SELECT * from books where '{selected}' regexp '{e_sch.get()}'; 应该是: S

我在这里定义了一个函数,它应该可以正常工作,因为我在其他地方使用了一个类似的函数,但没有给出任何条件(where..like或regexp),它在那里工作得很好,当我使用regexp时,它没有给出任何输出。为什么呢?提前感谢:)

代码:


有时我也会遇到此错误
UnboundLocalError:赋值前引用的局部变量“index”

SELECT语句的语法不正确:

SELECT * from books where '{selected}' regexp '{e_sch.get()}';
应该是:

SELECT * from books where `{selected}` regexp '{e_sch.get()}';

字段名应该用“`”包围,而不是
'

我认为
选择。。。其中“{selected}”…
应该是
SELECT。。。此处改为“{selected}”…
。请将其添加为asnwer,我可以标记它
SELECT * from books where `{selected}` regexp '{e_sch.get()}';