我最近遇到的一个问题是,尝试使用此代码更新数据库中的字段时无效。 我追溯到正在更新的文本中有%符号($ note,然后是$ note_escaped)...使用sprintf插入它虽然工作得很好。 p>
我应该不使用sprintf 更新,还是应该以不同的方式形成? p>
我做了一些搜索,但无法提出任何建议。 p>
$ id = mysql_real_escape_string($ id);
$ note_escaped = mysql_real_escape_string($ note);
$ editedby = mysql_real_escape_string($ author);
$ editdate = mysql_real_escape_string($ date);
//从表单插入信息到数据库
$ query = sprintf(“UPDATE notes_ $ suffix SET note ='$ note_escaped',editedby ='$ editedby',editdate ='$ editdate'WHERE id ='$ id'LIMIT 1”);
code > pre>
非常感谢! p>
div>