note 8365 deleted from function.odbc-num-rows by jimw
| From: | jimw@php.net | Date: | Mon, 17 Dec 2001 22:33:01 +0000 |
| Subject: | note 8365 deleted from function.odbc-num-rows by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23031@lists.php.net to get a copy of this message | ||
Hello. I'm Calin from Romania
I got the -1 result after SELECT on some drivers. I used objects, so I couldn't modify other
ways.Here's a function I wrote that overcomes this:
// PHP RecordCount function:
// 07.09.2000
// Calin Uioreanu DMS Romania
//
function RecordCount() ODBC drivers
{
$local_result=odbc_num_rows($this->ODBCid);
if ($local_result=="-1") {
$local_Internal_counter=$this->InternalCounter;
odbc_fetch_row($this->ODBCid,0); // rewind
$local_count=0;
while(odbc_fetch_row($this->ODBCid))
{
$local_count++; //compte RecordCount
}
odbc_fetch_row($this->ODBCid,$local_Internal_counter); // rewind
$this->InternalCounter=$local_Internal_counter;
$local_result=$local_count;
}
return $local_result;
}