简体   繁体   中英

sqlsrv_query not returning anything

I am trying to run a sqlsrv_connect SELECT query, and I am having issues getting any information back. No matter what query I run, sqlsrv_num_rows always returns a null value. I have verified that my queries are correct in SQL Server Management studio.

Some sample code:

$connection_info = array("UID"=>"uid", "PWD"=>"pwd", "Database"=>"db");
$c = sqlsrv_connect("tcp:hostname", $connection_info);
if (!$c) {
   die(0);
}
$sql = "QUERY";
$result = sqlsrv_query( $c, $sql );
$row_count = sqlsrv_num_rows( $result );
echo $sql . $row_count;

Is there anything I am doing wrong? What am I missing?

对我有用的解决方案是将array("Scrollable" => 'static')作为 select 函数的配置选项。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM