I finally found the problem
referring to the user alalp:
It is because sqlsrv_query () uses SQLSRV_CURSOR_FORWARD cursor type by
default However, in order to get a result from sqlsrv_num_rows (), you
should choose one of these cursor types below:
SQLSRV_CURSOR_STATIC SQLSRV_CURSOR_KEYSET
SQLSRV_CURSOR_CLIENT_BUFFERED For more information, check: Cursor
Types (SQLSRV Driver)
In conclusion, if you use your query like:
$ query = sqlsrv_query ($ conn, $ result, array (), array ("Scrollable" = >
'static')); you will get result in:
$ row_count = sqlsrv_num_rows ($ query);
The problem is that in SQL serverno elcount (*) or sqlsrv_num_rows since it is a different method as it recovers the information, so nothing but delivering a result
the correct method is (in sqlsrv)
<?php
$sql = "SELECT * FROM asistencia";
$params = array();
$options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET );
$stmt = sqlsrv_query( $conn, $sql , $params, $options );
$row_count = sqlsrv_num_rows( $stmt );
if ($row_count === false)
echo "Error in retrieveing row count.";
else
echo $row_count;
?>
If I find it hard to find why you do not deliver results in the way you shared (and thank you very much again) the companion alanfcm
I hope it's useful to someone.