SQL语法错误:检查手动

时间:2013-09-09 18:19:06

标签: php mysql sql syntax

所以我不是一个程序员,我正在研究这个PHP代码。我一直收到相同的错误消息,但不知道哪个部分有错误。 错误:

  

您的SQL语法有错误;检查手册   对应于您的MySQL服务器版本,以便使用正确的语法   在第1行附近')'

<html>
<head>
<title>OPAC mini Admin</title>
<link rel="stylesheet" type="text/css" href="style.css" />
</head>

<body id="home">

    <div id="date">
    <? 
        $today = date('m-d-Y');
    echo "Today is $today";
        ?><br>

</div>
<div id="logoTop">
    <img src = "images/OPACmini_logo.png"
     alt = "OPACmini logo here" width="355" height/>
</div>
<FORM method="post" id="form" action="aboutSystem.php">
<input type="submit" id="aboutBtn" name="submit" value="About System"/><br>
</FORM>
<FORM method="post" id="form" action="Logout.php">
<input type="submit" id="logoutBtn" name="submit" value="Log Out"/><br>
</FORM>

<?
 $con=mysqli_connect("mysql6.000webhost.com","a3656574_opacmin","opac2013","a3656574_opacmin");
    if (mysqli_connect_errno())
    {
       echo "Failed to connect to MySQL: " . mysqli_connect_error();
    }

$sql="SELECT * FROM `accounts`)";
while (!mysqli_query($con,$sql))
{
   die('Error: ' . mysqli_error($con));
}
?>
</div>
</body>
</html>

错误的原因可能是什么。先感谢您。

1 个答案:

答案 0 :(得分:3)

只需删除)

即可
$sql="SELECT * FROM `accounts`";