且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在PHP中使用ODBC连接获取计数或结果集中的行数?

更新时间:2023-02-06 08:54:12

odbc_num_rows seems to be reliable for INSERT, UPDATE, and DELETE queries only.

The manual says:

Using odbc_num_rows() to determine the number of rows available after a SELECT will return -1 with many drivers.

one way around this behaviour is to do a COUNT(*) in SQL instead. See here for an example.