By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,793 Members | 1,257 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,793 IT Pros & Developers. It's quick & easy.

python bottle sqlite edit code

P: 4
...def edit_member(no):
"""
Edit a gang member
"""
print('edit member')
if request.GET.get('save', '').strip():
edit = request.GET.task.strip()
lastname = request.GET.get('lastname', '').strip()
firstname = request.GET.get('firstname', '').strip()
birthdate = request.GET.get('birthdate', '').strip()
deathdate = request.GET.get('deathdate', '').strip()
address = request.GET.get('address', '').strip()
city = request.GET.get('city', '').strip()
state = request.GET.get('state', '').strip()
zipcode = request.GET.get('zip', '').strip()
father = request.GET.get('father', '').strip()
mother = request.GET.get('mother', '').strip()
gangid = request.GET.get('gangid', '').strip()
status = request.GET.get('status', '').strip()


if status == 'open':
status = 1
else:
status = 0

conn = sqlite3.connect('gang.db')
c = conn.cursor()
c.execute("UPDATE gangmember set,\
lastname = ?,\
firstname = ?,\
birthdate = ?,\
deathdate = ?,\
address = ?,\
city = ?,\
state = ?,\
zipcode = ?,\
father = ?,\
mother = ?,\
gangid = ?,\
status = ?,\
WHERE id LIKE ?", (lastname, firstname, birthdate, deathdate, address, city, state, zipcode, father, mother, gangid, status))
conn.commit()
return '<p>The item number %s was successfully updated</p>' % no

else:
conn = sqlite3.connect('gang.db')
c = conn.cursor()
c.execute("SELECT lastname, status FROM gangmember WHERE id LIKE ?", (str(no),))
cur_data = c.fetchone()
return template('edit_member', old=cur_data, no=no)

.....
error.... File "gangmember.py", line 117, in edit_member
WHERE id LIKE ?", (lastname, firstname, birthdate, deathdate, address, city, state, zipcode, father, mother, gangid, status))
OperationalError: near ",": syntax error
Dec 24 '18 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 621
There should not be a comma here
Expand|Select|Wrap|Line Numbers
  1. (str(no),))
Also, in the future, post your code between code tags (click on the code button above the box where you post). And paste the complete error message as we have no idea which comma the error is referring to.
Dec 25 '18 #2

Post your reply

Sign in to post your reply or Sign up for a free account.