大概是这样的 common = form["common"] query = "UPDATE tb SET %s = %s WHERE id = %s" cursor.execute(query, [common, field, updtae_id])
变量common代替字段名title。 然后common替代第一个 %s 时,SQL报错: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''title' = 'title3' WHERE id = '3'' at line 1"