我的MySQL语法出错

时间:2018-03-25 18:01:30

标签: php mysql

我不知道我的错误是什么,请帮帮我

我总是收到错误

  

您的SQL语法有错误;查看与MySQL服务器版本对应的手册,以便在'','asdasd','2010-11-25','asdasdasd','asdasdas','asdasdasd','2011-03-25附近使用正确的语法','asdasds'在第1行

{

$Category = $_POST["pcategory"];
$Code = $_POST["pcode"];
$Name = $_POST["pname"];
$doi = $_POST["doi"];
$poi = $_POST["poi"];
$Manager = $_POST["pmanager"];
$Coordinator = $_POST["pcoord"];
$Contract = $_POST["dcontract"];
$Purpose = $_POST["ppurpose"];
$Scope = $_POST["pscope"];
$pcd = $_POST["pcd"];
$isd = $_POST["isd"];
$ied = $_POST["ied"];

$sql = "INSERT INTO metaproject (pcategory,pcode,pname,doi,poi,pmanager,pcoord,dcontract,ppurpose,pscope,pcd,isd,ied) values ('$Category',$Code','$Name','$doi','$poi','$Manager','$Coordinator','$Contract','$Purpose','$Scope','$pcd','$isd','$ied')";
  echo $sql;

$result = mysqli_query($connect,$sql);
if(!$result)
  echo mysqli_error($connect);
else
  echo "<div style='margin-top:20px'class='alert alert-success alert-dismissable' id='flash-msg'>
    <button aria-hidden='true' data-dismiss='alert' class='close' type='button'>×</button>
    <h4><i class='icon fa fa-check'></i>Success!</h4>
    </div>";

}
?>

1 个答案:

答案 0 :(得分:0)

$ Code'应为'$ Code'缺少单引号