开发者

T_CONSTANT_ENCAPSED_STRING blocking ip [closed]

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 9 years ago.

Here is line 37;

$write = mysql_query("INSERT INTO `trial' VALUE开发者_运维技巧S (" '', '".$ip."', '1' ") or die(mysql_error());

The error may be coming from further up.. But I'm not quite sure :S

I am trying to block the ip of a


There are both PHP and SQL syntax errors in the same line of code.

You incorrectly quoted your table name, have misplaced double quotes in your VALUES expression and have misplaced parentheses in your or die statement. Here's the fixed statement:

$write = mysql_query("INSERT INTO `trial` VALUES ( '', '".mysql_real_escape_string($ip)."', '1' )") or die(mysql_error());

(Additionally, yes, I did throw in that mysql_real_escape_string() in case you didn't escape your query variables.)


You have a wrong quote here:

`trial'
      ^


You have some " inside the VALUES() that are not escaped. And trial is quoted wrong. (as codaddict mentioned)

$write = mysql_query("INSERT INTO `trial` VALUES ('', '".$ip."', '1') or die(mysql_error());
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜