0
我的查询:所有符号后“和”剥离
mysql::getInstance()->update('requests', array('response' => mysql_real_escape_string($_POST['status'])), array('secret' => $_POST['secret'])); ?>
如果我魔杖与“&”符号,所有符号添加字符串后“&”剥离。 !
举例: 字符串:“№;%:? ()_ + @#$%^ &()_ +
数据库我只看到:!” №; %:?*()_ +!@#$%^
如何解决这个问题?
更新功能,如果有人需要:
function update($table, $updateList, $whereConditions)
{
$updateQuery = '';
foreach ($updateList as $key => $newValue) {
if (!is_numeric($newValue)) {
$newValue = "'" . $newValue . "'";
}
if (strlen($updateQuery) == 0) {
$updateQuery .= '`' . $key . '` = ' . $newValue;
} else {
$updateQuery .= ', `' . $key . '` = ' . $newValue;
}
}
return $this->query('UPDATE ' . $table . ' SET ' . $updateQuery . $this->buildWhereClause($whereConditions));
}
UPD: 回声的MySQL ::的getInstance() - > getLastSQL()说:
UPDATE requests SET `response` = '!\"№;%:?*()_ [email protected]#$%^' WHERE `secret` = '52a4ab5f7f3e8491e60b71db7d775ee2'
左右,随着MySQL的功能更新问题类?
Slaks,我需要使用str_replace函数( '&', '%28',$查询); ?
如果你回显'$ _POST ['status']',你看到了什么? – SLaks 2010-03-28 01:39:48
作为旁注:您的更新例程应确保转义newValue字符串,而不是调用方。 – hurikhan77 2010-03-28 01:47:41
hurikhan77,请问我可以看看示例代码吗? – user300413 2010-03-28 02:02:20