我在下面有此更新语句:
string_from_base64_encode_ends_with = base64_encode(serialize($_POST));
UPDATE members SET settings = 'string_from_base64_encode_ends_with=='
WHERE email = "right@emailhere.com" AND active=1
(Localhost)当我使用
mysql_query()
处理时,实际记录未更新,尽管mysql_affected_rows()
返回1(localhost),但是当我复制此更新语句时,然后通过phpmyadmin 来处理;它有效,mysql_affected_rows()返回1&真实记录确实更新了
(实时主机)使用这些代码,没有更改,当我在实时主机上运行时;一切都很好:记录更新,mysql_affected_rows()返回1
您可以帮助我发现MySQL Server出了问题吗?还是其他东西?
非常感谢
ps:所有其他更新语句在Localhost&实时主机,更新;此语句仅是问题
您需要使用mysql_real_escape_string()
逃脱字符串$string = mysql_real_escape_string("string_from_base64_encode_ends_with==");
mysql_query("UPDATE members SET settings = '".string ."' WHERE email = "right@emailhere.com" AND active=1");