Php 这个代码怎么会出错?

Php 这个代码怎么会出错?,php,mysql,binary,Php,Mysql,Binary,我不断得到这个错误,我非常肯定我的语法是正确的 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_conn

我不断得到这个错误,我非常肯定我的语法是正确的

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;
    }
}
?>

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

您必须在BINARY周围使用反勾号,因为BINARY是MySQL的保留关键字

就像这样:

 SELECT * FROM ascii_binary WHERE `binary` ='$char'

binary
是一个保留字,在查询中使用时需要使用反勾号