如何解决此错误PHP解析错误:语法错误、意外'';?

如何解决此错误PHP解析错误:语法错误、意外'';?,php,Php,我认为insert查询应该以分号结尾,因为类似的代码用于另一个表单。但它显示了这个错误: PHP Parse error: syntax error, unexpected ';' 下面是我的一段PHP脚本,用于将数据从表单插入数据库 if((!empty($name) && !empty($location) && !empty($fulladdress) && !empty($ownername) && !empty($own

我认为insert查询应该以分号结尾,因为类似的代码用于另一个表单。但它显示了这个错误:

PHP Parse error: syntax error, unexpected ';'
下面是我的一段PHP脚本,用于将数据从表单插入数据库

if((!empty($name) && !empty($location) && !empty($fulladdress) && !empty($ownername) && !empty($ownercontact) && !empty(category) && 
                    ($invalidphflag==true) && ($phoneflag==true) && !empty($size) && !empty($price) )
        {
                $insertquery= "INSERT INTO properties (name, location, address, owner_name, owner_no, size, price, category) 
                VALUES ('$name', '$location', '$fulladdress', '$ownername', '$ownercontact', '$size', '$price', '$category')";

            $query = mysqli_query($db, $insertquery);

            if($query)
            {
             $success= "Details submitted successfully.";
            }   



    }
如果(!empty($name)&&!empty($location)&&!empty($fulladdress)&!empty($ownername)&&!empty($ownercontact)&&!empty(category)&&
($invalidphflag==true)&&($phoneflag==true)&&!empty($size)&&!empty($price))


在if语句中有一个未关闭的括号。
比closing

因此,您的if语句应该如下所示:

 if ((!empty($name) && !empty($location) && !empty($fulladdress) && !empty($ownername) && !empty($ownercontact) && !empty(category) && 
        ($invalidphflag==true) && ($phoneflag==true) && !empty($size) && !empty($price) 
    ))
导致:

 if ((!empty($name) && !empty($location) && !empty($fulladdress) && !empty($ownername) && !empty($ownercontact) && !empty(category) && 
    ($invalidphflag==true) && ($phoneflag==true) && !empty($size) && !empty($price) 
))
{
    $insertquery= "INSERT INTO properties (name, location, address, owner_name, owner_no, size, price, category) 
        VALUES ('$name', '$location', '$fulladdress', '$ownername', '$ownercontact', '$size', '$price', '$category')";

    $query = mysqli_query($db, $insertquery);

    if ($query)
    {
        $success= "Details submitted successfully.";
    }   
}

你错过了
$
签名
!在条件的第一部分中为空(类别)

你在第一个IF语句的末尾缺少了一个括号。不需要所有这些答案。这只是一个简单的打字错误。或者少一个,只要有两个是没有意义的:)没有
$
的话,它是如何工作的!空(类别)?
 if ((!empty($name) && !empty($location) && !empty($fulladdress) && !empty($ownername) && !empty($ownercontact) && !empty(category) && 
    ($invalidphflag==true) && ($phoneflag==true) && !empty($size) && !empty($price) 
))
{
    $insertquery= "INSERT INTO properties (name, location, address, owner_name, owner_no, size, price, category) 
        VALUES ('$name', '$location', '$fulladdress', '$ownername', '$ownercontact', '$size', '$price', '$category')";

    $query = mysqli_query($db, $insertquery);

    if ($query)
    {
        $success= "Details submitted successfully.";
    }   
}
if((!empty($name)
    && !empty($location)
    && !empty($fulladdress)
    && !empty($ownername)
    && !empty($ownercontact)
    && !empty($category)
   )
&&
   ($invalidphflag == true
   && $phoneflag == true
   && !empty($size)
   && !empty($price)
   )){
        $insertquery= "INSERT INTO properties (name, location, address, owner_name, owner_no, size, price, category) 
                VALUES ('$name', '$location', '$fulladdress', '$ownername', '$ownercontact', '$size', '$price', '$category')";
        $query = mysqli_query($db, $insertquery);
        if($query)
        {
           $success= "Details submitted successfully.";
        }   
   }