这段代码怎么会出错?(How is there an error with this code?)

我一直收到这个错误,我非常肯定我的语法是正确的!

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 '='00001010'' at line 1

PHP代码:

<?php $decode = str_split($_POST['ascii'], 8); mysql_connect("localhost","Username","Password"); mysql_select_db("information"); foreach($decode as $char){ $query = mysql_query("SELECT * FROM ascii_binary WHERE binary='$char'") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { $char = $row['character']; echo $char; } } ?>

I keep getting this error, I'm am very positive that my syntax is right!

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 '='00001010'' at line 1

PHP Code:

<?php $decode = str_split($_POST['ascii'], 8); mysql_connect("localhost","Username","Password"); mysql_select_db("information"); foreach($decode as $char){ $query = mysql_query("SELECT * FROM ascii_binary WHERE binary='$char'") or die(mysql_error()); while ($row = mysql_fetch_array($query)) { $char = $row['character']; echo $char; } } ?>

最满意答案

BINARY是MySQL中的保留关键字。 可能这就是你错误的原因。 因此,尝试在MySQL数据库中重命名列。

BINARY is reserved keyword in MySQL. Probably thats the reason of your error. So try to rename your column in MySQL database.

更多推荐