I am fairly new to SQL-Server and PHP, but I\'m trying to get the total number of rows in my table with PHP.
This is the code I am using, it connects just fine, however
I believe that your call to
print_r(sqlsrv_fetch_object($stmt));
might be wrong. At least looking at the documentation in regards to how the call is made, indicates that there might be an error there.
http://www.php.net/manual/en/function.sqlsrv-fetch-object.php
You might want to try using fetch instead of fetch-object. I would suggest following the example.
http://www.php.net/manual/en/function.sqlsrv-fetch.php
Check it:
http://www.php.net/manual/es/function.sqlsrv-num-rows.php
"sqlsrv_num_rows()
— Retrieves the number of rows in a result set"
Like:
$row_count = sqlsrv_num_rows( $stmt);
echo 'numRows: ',$row_count;