首页 > 解决方案 > sqlssrv_num_rows not returning anything

问题描述

I have found and read sqlsrv_num_rows Not Returning Any Value. I have updated the $options based on the solution, but my code still does not return any results.

If I run the query in SQL, I get 8 records, so I know the data is there.

$sql = "SELECT * FROM Question WHERE Category = 'HD';";
$params = array();  
$options =  array( "Scrollable" => 'keyset' ); 
$stmt = sqlsrv_query( $conn, $sql, $params, $options ); 
if( $stmt === false ) { reportSQLError($sql, $params); }
$maxHDQ = sqlsrv_num_rows($stmt);

标签: phpsql-server

解决方案


The code itself is ok and should work. What are the values for $stmt and $maxHDQ?


推荐阅读