0
我收到有关我的查询的错误,但我不理解问题可能是什么。我得到的错误是更新查询时出现MySQL语法错误
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 'range = '55', atkspeed = '0.95', m_damage = '0', p_damage = '38', mprotection = ' at line 1
,而我使用的代码是这样的一个
$id = mysql_real_escape_string($_POST["id"]);
$value0 = mysql_real_escape_string($_POST["value0"]);
$value1 = mysql_real_escape_string($_POST["value1"]);
$value2 = mysql_real_escape_string($_POST["value2"]);
$value3 = mysql_real_escape_string($_POST["value3"]);
$value4 = mysql_real_escape_string($_POST["value4"]);
$value5 = mysql_real_escape_string($_POST["value5"]);
$value6 = mysql_real_escape_string($_POST["value6"]);
$value7 = mysql_real_escape_string($_POST["value7"]);
$value8 = mysql_real_escape_string($_POST["value8"]);
$value9 = mysql_real_escape_string($_POST["value9"]);
$value10 = mysql_real_escape_string($_POST["value10"]);
$query="UPDATE char_stats SET vita = '$value0', mana = '$value1', speed = '$value2', range = '$value3', atkspeed = '$value4', m_damage = '$value5', p_damage = '$value6', mprotection = '$value7', pprotection = '$value8', hp5 = '$value9', mp5 = '$value10' WHERE id_char_stats='$id'";
我使用的是还有其他非常类似的查询,所以我不明白的问题,可能是什么。我正在考虑char_stats上的下划线,所以我尝试使用
char\_stats
逃脱,但它无法正常工作。
在此先感谢
这是可能出错了$值2(如一个双引号/撇号) - mysql的倾向显示的代码位只是语法错误之后。 – Giles
'$ value2'是否包含'''? –
'$ value2'是一个整数,所以它不应该包含任何''' – Mastarius