I am trying to add two values in a table by calling functions of a file. The file has following code:
import sqlite3
con = sqlite3.Connection('rdb')
cur = con.cursor()
def insert(s):
cur.execute("create table if not exists customerorder(no number primary
key,menuitems varchar(40))")
c=1
for i in s:
print c
print i
cur.execute("insert into customerorder(?,?)",(int(c),i))
c += 1
def fetch():
cur.execute("select * from customerorder")
print cur.fetchall()
Here 's' is a list. Having s[0]='simple book' and s[1] = 'advance book'.