sql数据库三个表使用了内连接但它给出了错误。图像中显示错误。我不知道问题是什么。
Regserver.php
<?php
include 'Connection.php';
$reg = $_GET['reg'];
$sql = "select RegNo,a.RollNo,b.Standard,b.stdid,c.DivisionID,c.Division,Std_Name as StudentName,Std_Address,DOB,ContactNo1 as FatherNo,ContactNo2 as MotherNo,
School_Name as SchoolName,Decide_Fees as DecideFees,ImagePath
from Std_Reg as a inner join StandardMaster as b on a.Standard = b.stdid
inner join DivisionMaster as c on a.Division =c.DivisionID
where RegNo= '$reg'";
//$sql = "select * from Std_Reg";
$stmt = sqlsrv_query($conn, $sql);
do {
while ($row = sqlsrv_fetch_array($stmt, SQLSRV_FETCH_ASSOC)){
$result[] = $row;
}
} while (sqlsrv_next_result($stmt));
if(count($result)>0)
{
$result1['status']=1;//"Login successfully";
array_push($result,$result1);
}
else
{
//$result[]="null";
$result1['status']=0;//"Record not found";
array_push($result,$result1);
}
sqlsrv_free_stmt($stmt);
sqlsrv_close($conn); //Close the connnectiokn first
echo json_encode($result); //You will get the encoded array variable
?>
答案 0 :(得分:0)
错误说你没有定义变量
尝试在使用
之前声明它PHP 5.4之前:
$myArray = array();
PHP 5.4及更高版本
$myArray = [];
告诉我们这是否对你不起作用。