Php 分析错误:语法错误,<;中意外的T_变量;文件>;

Php 分析错误:语法错误,<;中意外的T_变量;文件>;,php,mysql,Php,Mysql,请有人告诉我哪里错了?我在运行脚本时遇到以下错误: 分析错误:语法错误,第32行的C:\wamp\www\baljeet2\ViewAllPolicy1.php中出现意外的T_变量 这是我的完整代码: <!DOCTYPE html> <html> <body bgcolor='white'> <?PHP include 'config.php'; session_start(); //if ($_SESSION['auth']!='TRUE') {

请有人告诉我哪里错了?我在运行脚本时遇到以下错误:

分析错误:语法错误,第32行的C:\wamp\www\baljeet2\ViewAllPolicy1.php中出现意外的T_变量

这是我的完整代码:

<!DOCTYPE html>
<html>
<body bgcolor='white'>
<?PHP
include 'config.php';
session_start();

//if ($_SESSION['auth']!='TRUE') {

//header ("Location: ../a_login.php");

//}

?>

<?PHP

$con=mysqli_connect($host,$user,$pass,$DB_name);

 if (mysqli_connect_errno($con))
   {
   echo "Failed to connect to MySQL: " . mysqli_connect_error();
   }
   else
   {
   echo "";
   }  

$result = mysqli_query($con,"SELECT * FROM policydetail1");
echo "pass<br>";

int $num_rows=0;


$num_rows= mysql_num_rows($result);
if ($num==0) {
  // Show message
    echo "No record Found";
} else {
  // do your while stuff here

while($row = mysqli_fetch_array($result))
{
echo $row['CompanyName']." ".$row['PolicyNo']." ".$row['OD']." ".$row['ThirdParty']." ".$row['ServiceTaxRate']." ".$row['TotalAmount']." ".$row['Discount']." ".$row['CommissionRate']." ".$row['Commission']." ".$row['CommissionStatus']." ".$row['Date']."<br>";
}

}

    mysqli_close($con);





     //echo "<div align='center'><div style='background-color:#4682B4; color:white; width:1000px; height:30px; text-align:center; font-family:trebuchet ms;'>Policy Add Succefully!!!</div></div><br> <div align='center'><a href='Add Policy Form.html'>Add more records</a><a href='Add Policy Form.html'> <BR>Back to Main Menu</a></div>";

    ?>

我还检查了分号和语法,但没有找到任何内容。

int
在PHP中不是关键字。所以它将其解释为变量名。然后紧接着是另一个变量名(
$num_rows
),这是解析器不希望看到的

我想你的意思是:

$num_rows = 0;

您不需要声明变量类型。解释器将在需要时识别类型。

int
在PHP中不是关键字。所以它将其解释为变量名。然后紧接着是另一个变量名(
$num_rows
),这是解析器不希望看到的

我想你的意思是:

$num_rows = 0;

您不需要声明变量类型。解释器将在需要时识别类型。

Php是动态类型语言。这意味着变量没有类型。是已知变量内容基类型的运行时

<?php

    $var = 0;     echo gettype($var);  // integer
    $str = 'str'; echo gettype($str);  // string
    $boo = false; echo gettype($boo$); // boolean

Php是一种动态类型语言。这意味着变量没有类型。是已知变量内容基类型的运行时

<?php

    $var = 0;     echo gettype($var);  // integer
    $str = 'str'; echo gettype($str);  // string
    $boo = false; echo gettype($boo$); // boolean

int$num\u行=0
不是有效的PHP。请删除
int
关键字,因为PHP变量声明不是在C/C++/Java中键入的。此问题似乎与主题无关,因为它涉及语法错误
int$num\u rows=0
不是有效的PHP。请删除
int
关键字,因为PHP变量声明不是像C/C++/Java中那样键入的。这个问题似乎与主题无关,因为它与语法错误有关