請有人告訴我,我錯了嗎?我收到的時候我運行腳本以下錯誤:解析錯誤:語法錯誤,在<file>
Parse error: syntax error, unexpected T_VARIABLE in C:\wamp\www\baljeet2\ViewAllPolicy1.php on line 32
這裏是我的完整代碼:
<!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>";
?>
我是新來的PHP和做很難發現這個錯誤。上線32碼以下:
int $num_rows=0; //Here I am getting error
我還檢查發現,分號和語法,但一無所獲。
'$ INT NUM_ROWS = 0;'是_not_有效的PHP。 –
刪除int部分 –
刪除'int'關鍵字,因爲PHP變量聲明不像C/C++/Java中那樣輸入。 –