creitve
creitve

Reputation: 783

Python doesn't save data to sqlite db

This is my code:

conn = sqlite3.connect(nnpcconfig.commondb)
cur = conn.cursor()
query = ['2124124', 'test2', 'test3', 'test4', 'test5']
cur.execute("insert into users(id, encpass, sname, name, fname) values (?, ?, ?, ?, ?)", query)
conn.commit
cur.execute("select * from users")
for row in cur:
    print row

This code works, returning row fed to it. But it comes out that once script terminated, table is clear again! Where's the mistake? Of course, table users exists.

Upvotes: 7

Views: 12004

Answers (1)

John Machin
John Machin

Reputation: 82924

You have another mistake: conn.commit instead of conn.commit()

Upvotes: 12

Related Questions