我在PHP中的SQL Server查询给我一个错误。
在SQL Server 13中连接并使用php 7.3
类型(SQL Server语句)的资源(44)
有人可以告诉我这个错误吗?
$servername="GABO\SQLEXPRESS";
$uid="sa";
$pwd="";
$database="GABO";
$connectionInfo=array(
"Database"=>$database
);
$conn=sqlsrv_connect($servername,$connectionInfo);
if($conn){
echo "Connection established.\n";
}else {
echo "Connection could not be Establish\n";
die(print_r(sqlsrv_errors(),true));
}
$tsql="SELECT * from TABLE_1";
$stmt=sqlsrv_query($conn,$tsql);
if($stmt){
var_dump($stmt);
echo "Error in statement execution.";
}else{
die(print_r(sqlsrv_errors(),true));
}
while($row=sqlsrv_fetch_array($stmt,SQLSRV_FETCH_ASSOC)){
echo 'some data';
}
sqlsrv_free_stmt($stmt);
sqlsrv_close($conn);