Unknown column '' in 'field list'

版权声明:本文为博主原创文章,但部分内容来源自互联网,大家可以随意转载,点赞或留言均可! https://blog.csdn.net/csdn_kou/article/details/84070534

Unknown column ‘’ in ‘field list’ 解决办法

正确写法:
        cursor.execute("update book set name='%s' where id=%d" % (name, int(id)))
错误写法:
        cursor.execute("update book set name=%s where id=%d" % (name, int(id)))

你要获取字符串接收方式是

'%s'

要获取整形数字
int(id)

其他原因

多了一个空格
https://blog.csdn.net/gnail_oug/article/details/53606608

猜你喜欢

转载自blog.csdn.net/csdn_kou/article/details/84070534