douyan1970 2014-08-25 19:42
浏览 273

您的SQL语法有错误; 查看与您的MySQL服务器版本对应的手册,以便在第29行附近的')'附近使用正确的语法[关闭]

When I run this code, I get the error in the question title:

if($_SERVER["REQUEST_METHOD"] == "POST") {
        $Name_of_the_Donor=addslashes($_POST['Name_of_the_Donor']);
        $Father_Name=addslashes($_POST['Father_Name']);
        $Date_of_Birth = $_POST["bYear"]."-".$_POST["bMonth"]."-".$_POST["bDay"];
        $Gender=addslashes($_POST['Gender']);
        $Mobile_No1=addslashes($_POST['Mobile_No1']);
        $Blood_Group=addslashes($_POST['Blood_Group']);
        $Email_ID=addslashes($_POST['Email_ID']);
        $Password=addslashes($_POST['Password1']);
        $District=addslashes($_POST['District']);
        $Pincode=addslashes($_POST['Pincode']);
        $Weight=addslashes($_POST['Weight']);

        $timezone = "Asia/Calcutta";
        if(function_exists('date_default_timezone_set')) date_default_timezone_set($timezone);
        $Date_of_Registration=date('Y-m-d H:i:s');

        $Ip_Address=$_SERVER["REMOTE_ADDR"];

        mysql_query("INSERT INTO `donor` (
                         `Donor_Id` ,
                         `Name_of_the_Donor` ,
                         `Father_Name` ,
                         `Date_of_Birth` ,
                         `Gender` ,
                         `Mobile_No1` ,
                         `Blood_Group` ,
                         `Email_ID` ,
                         `Password` ,
                         `District` ,
                         `Pincode` ,
                         `Weight` )

                      VALUES (
                      NULL , 
                      '$Name_of_the_Donor' , 
                      '$Father_Name' , 
                      '$Date_of_Birth' , 
                      '$Gender' , 
                      '$Mobile_No1' , 
                      '$Blood_Group' , 
                      '$Email_ID' , 
                      '$Password' , 
                      '$District' , 
                      '$Pincode' , 
                      '$Weight' , 

                      );") or die("<h1>".mysql_error()."</h1>");

    }
echo "<h1><em>Your Registration Successfully Completed please Login</em> </h1>";
  • 写回答

1条回答 默认 最新

  • dongmieqiao3152 2014-08-25 19:47
    关注

    You have an extra comma after '$Weight' here:

                      '$Weight' , 
    
                      );") or die("<h1>".mysql_error()."</h1>");
    
    评论

报告相同问题?

悬赏问题

  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化