Rumah > Soal Jawab > teks badan
1
cur.execute("UPDATE scholars SET name='{}' WHERE id={} and name is null".format(author, scholar_id))
cur.execute(
"UPDATE scholars SET name='{}' WHERE id={} and name is null"
.
format
(author, scholar_id))
2
psycopg2.ProgrammingError: syntax error at or near "Neill"
psycopg2.ProgrammingError: syntax error at
or
near
"Neill"
LINE 1: UPDATE scholars SET name='O'Neill, Kevin' WHERE id=12403 and...
LINE
: UPDATE scholars
SET
name
=
'O'
Neill, Kevin' WHERE
id
12403
and
...
数据应该是:O'Neill, Kevin
三叔2016-10-22 17:23:09
"""UPDATE scholars SET name = %s WHERE id = %s and name is null""", (author, scholar_id))
"""UPDATE scholars SET name = %s WHERE id = %s and name is null"""
, (author, scholar_id))