我正在使用Python/Flask並試圖查詢我的數據庫。SQL選擇不工作的地方
conn = sqlite3.connect('./flaskdb.db')
cur = conn.cursor()
cur.execute('SELECT email FROM users WHERE email=\'%s\'', "name")
我有2列,email, password
和作爲行/條目之一的值name, password
。
爲什麼不能正常工作?我得到的錯誤:
sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 0, and there are 7 supplied.
請發佈一個完整的示例,以便我們可以看到至少整個導致錯誤的python語句。與往常一樣,[最小化,完整且可驗證的示例](http://stackoverflow.com/help/mcve)使我們更容易爲您提供幫助。 – 2ps
請顯示完整的代碼。通常使用預處理語句,您不必擔心在參數周圍使用單引號,因爲API會爲您處理這些問題。 –
@ 2ps,更新了代碼 – garoo