用 flask pysql 查询 mysql:
sql="select client_ip, result, date_time from ipset where client_ip='commit_ip'"
返回是空的,把 commit_ip 换成 222.222.222.222 就能查询出来,不清楚 commit_ip 这个变量要怎么定义? commit_ip 是 html post 过来的,mysql 里的 client_ip 数据类型是 char(15),这个语句应该怎么写呢?
1
annirg OP 已解决, client_ip= %s ,cursor.execute(sql,(commit_ip,))
|