Get number of rows in SQL-Server with PHP

前端 未结 2 356
轮回少年
轮回少年 2021-01-21 12:43

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

2条回答
  •  无人共我
    2021-01-21 13:00

    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

提交回复
热议问题