Python Forum

Full Version: Problem with sqlite bindings
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm trying to update a sqlite database and I get the following error: sqlite3.ProgrammingError: Incorrect number of bindings supplied. The current statement uses 1, and there are 4 supplied. I don't understand where I'm going wrong. The code is below:

        conn = sqlite3.connect('financial.db')
        c = conn.cursor()
        c.execute("SELECT * FROM totals")
        records = c.fetchall()

        for record in records:


            if record[0] ==arrivale.get():


                t = ratee.get()
                c.execute("UPDATE totals SET rent = ? ", (t))
                c.fetchall()
do you mean:
if record[0] == "arrivale.get()":
No. It shouldn't have ""
if that's not part or the html, then where's the code for arrivale.get()?
Not showing enough code
I figured it out. The code should have a ',' after the t like the follwoing:

c.execute("UPDATE totals SET rent = ? ", (t,))