Re: problem using odbc_fetch_row to count rows
| From: | Tyson Lloyd Thwaites | Date: | Thu, 31 Aug 2000 07:10:36 +0000 |
| Subject: | Re: problem using odbc_fetch_row to count rows | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-2510@lists.php.net to get a copy of this message | ||
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@webmedia.com.au>
To: <php-db@lists.php.net>
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@lists.php.net
> For additional commands, e-mail: php-db-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>