Reputation: 1573
here is my query
x.execute("UPDATE details SET name =%s,"(form.newname)"WHERE name =%s," (form.name))
am getting syntax error
.can anyone pls help to fix it
Upvotes: 0
Views: 281
Reputation: 7268
You can try :
x.execute("""UPDATE details SET name = "%s" WHERE name = "%s" """, (form.newname, form.name))
If form.newname
and form.name
are TEXT
fields in database, you have to pass %s
with parenthesis "%s"
Upvotes: 0
Reputation: 746
Based on syntax: cursor.execute(sql_query, args)
It should be like:
x.execute("UPDATE details SET name = %s WHERE name = %s", (form.newname, form.name))
Upvotes: 1
Reputation: 32003
If you want to update those name which is ending with the letter "s"
then you have to use LIKE operator in where clause
update destails set name ="adfsf" where name like '%s'
Upvotes: 0