Reputation: 180
Having an issue with sqlsrv_query
. This is the error I get:
PHP Warning: sqlsrv_num_rows() expects parameter 1 to be resource, boolean given
Here is the relevant code:
$tsql = "SELECT * FROM customers";
$stmt = sqlsrv_query($conn, $tsql, array(), array("Scrollable" => SQLSRV_CURSOR_STATIC));
$recordcount = sqlsrv_num_rows($stmt);
Upvotes: 0
Views: 4600
Reputation: 32145
The documentation on sqlsrv_query()
has everything you need to know.
Return Values
Returns a statement resource on success and FALSE if an error occurred.
$stmt = sqlsrv_query( $conn, $sql, $params);
if( $stmt === false ) {
die( print_r( sqlsrv_errors(), true));
}
Upvotes: 1