Php sqlsrv_查询返回false,没有任何错误(sqlsrv_errors())
为了插入一组行并返回结果,我们必须执行MSSQL存储过程。在MicrosoftSQLServerManagementStudio中执行此过程时,其工作状态完全符合预期。但在PHP中使用Php sqlsrv_查询返回false,没有任何错误(sqlsrv_errors()),php,sql-server,stored-procedures,sqlsrv,Php,Sql Server,Stored Procedures,Sqlsrv,为了插入一组行并返回结果,我们必须执行MSSQL存储过程。在MicrosoftSQLServerManagementStudio中执行此过程时,其工作状态完全符合预期。但在PHP中使用sqlsrv\u execute或sqlsrv\u query执行时,它不起作用。它只插入一行,不返回任何行 可以找到存储过程 PHP代码是 //Here my SP required one argument. so i passed one argument. this @param and stored pr
sqlsrv\u execute
或sqlsrv\u query
执行时,它不起作用。它只插入一行,不返回任何行
可以找到存储过程
PHP代码是
//Here my SP required one argument. so i passed one argument. this @param and stored procedure argument name should be same(case sensitive)
$sql = " { call ResmaxCompareWithProduction ( ?,? ) } ";
$param1 = 'All';
$param2 = 'desk';
$params = array(array(&$param1, SQLSRV_PARAM_IN),array(&$param2, SQLSRV_PARAM_IN));
$stmt = sqlsrv_prepare($conn,$sql,$params);
if ($stmt===false) {
// handle error
print_r(sqlsrv_errors(),true);
}else{
if (sqlsrv_execute($stmt)===false) {
// handle error. This is where the error happens
print_r(sqlsrv_errors(),true);
}
else
{
$resultsetarr = array();
while($row = sqlsrv_fetch_array($stmt)){
$resultArray[] = $row;
}
print_r($resultArray);
// success! It never gets here, though.
}
}
我试图对过程返回的结果进行var_转储,它输出类型为(SQL Server语句)的resource(4)
sqlsrv_errors()返回NULL
sqlsrv\u fetch\u数组
returnedboolean(false)
我甚至尝试使用sqlsrv\u query
而不是sqlsrv\u prepare
和sqlsrv\u execute
,但结果相同
你们能帮我找出问题所在,让程序按预期运行吗