Easysoft Data Access

Why does SQLRowCount/odbc_num_rows and $sth->rows return -1?

Last Reviewed:
2nd January 2024

odbc_num_rows is the PHP wrapper for the ODBC API SQLRowCount. $sth->rows is the Perl DBI method of obtaining the results from the ODBC API SQLRowCount.

Most ODBC drivers only return a meaningful number from SQLRowCount call when you execute row changing SQL e.g. UPDATES, DELETES, INSERTS. For SELECTS most ODBC drivers return -1.

Applies To

Knowledge Base Feedback

* Did this content help you?
* Please select one option based on your first choice:

(* Required Fields)