-5

Table

c.execute("CREATE TABLE project (
    id INTEGER PRIMARY KEY AUTOINCREMENT,
    content TEXT,
    postdate TIMESTAMP NOT NULL default CURRENT_TIMESTAMP)
")

te = "testing"
c.execute("INSERT INTO project (content) values (?)", (te))

Error

sqlite3.ProgrammingError: Incorrect number of bindings supplied.
    The current statement uses 1, and there are 7 supplied.
dhke
  • 15,008
  • 2
  • 39
  • 56
Kalyan Ram
  • 61
  • 1
  • 2
  • 8
  • which is it? 2754 are supplied or 7 are supplied? why are your error messages between your title and question different? – Kritner Jul 14 '15 at 13:52

1 Answers1

4

Try to change it into:

c.execute("INSERT INTO project (content) values (?)", (te,))

(with the comma after the te). This is because (te) without the comma is not a tuple, and you have to pass the parameters in a tuple. If you only have one element, you have to tell python that it is a tuple by inserting a final comma.

Uyghur Lives Matter
  • 18,820
  • 42
  • 108
  • 144
bcap
  • 500
  • 5
  • 14