Running MSSQL with PHP on Windows sometimes returns -1 for the function odbc_num_rows() even when there are rows in the result. This function fixes the problem:
function best_odbc_num_rows($result,$currentRow=0) {
$numRecords = 0;
odbc_fetch_row($result, 0);
while (odbc_fetch_row($result))
{
$numRecords++;
}
odbc_fetch_row($result, $currentRow);
return $numRecords;
}
No comments:
Post a Comment