1. 程式人生 > >Unknown column '' in 'field list'

Unknown column '' in 'field list'

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)

其他原因