Re: [PHP-DB] problem using odbc_fetch_row to count rows From: Tyson Lloyd Thwaites (tysonlt <email protected>)
Date: 08/31/00

Hi gang,

This problem only occurs when connecting to Oracle.
When connecting to Sybase the row pointer updates properly.

Does this mean a problem with Oracle's odbc driver?
Would usinga different odbc driver (ie openlink) help?

----- Original Message -----
From: Tyson Lloyd Thwaites <tysonlt <email protected>>
To: <php-db <email protected>>
Sent: Thursday, August 31, 2000 2:30 PM
Subject: [PHP-DB] problem using odbc_fetch_row to count rows

> Hi all,
>
> I am having some trouble resetting odbc_fetch_row.
> I am using the following code to get the row count:
>
> for ($i=0; odbc_fetch_row($this->qry, $i); $i++);
> $this->rowcount = $i;
> odbc_fetch_row($this->qry, 1); <<< this should
> reset it, shouldn't it?
>
> However, if I use that, any subsequent calls to odbc_result return the
last
> row (row $i), regardless of what I
> pass to odbc_fetch_row.
>
> The program flow goes like this:
>
> while ($db->MoveNext()) {
> for ($j=1; $j <= $db->GetColumnCount(); $j++) {
> echo $db->GetValue($j);
> }
> }
>
> MoveNext basically does $this->row++, and then calls
> odbc_fetch_row($this->qry, $this->row).
> $db->GetColumnCount() just returns odbc_result($this->qry, <param>).
>
> If there are three rows, what I get is three lots of the last row. If I
> remove that row counting bit and
> just hardcode the rowcount into the loop, it works fine.
>
> Any clues? Am I missing something dumb, or is PHP not updating the
internal
> row pointer properly?
>
> Regards,
>
> Tyson Lloyd Thwaites
> IT&e Ltd
>
>
> --
> PHP Database Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-db-unsubscribe <email protected>
> For additional commands, e-mail: php-db-help <email protected>
> To contact the list administrators, e-mail: php-list-admin <email protected>
>
>

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-db-unsubscribe <email protected>
For additional commands, e-mail: php-db-help <email protected>
To contact the list administrators, e-mail: php-list-admin <email protected>