Re: odbc_fetch_row()
| From: | Scott Fletcher | Date: | Fri, 20 Sep 2002 19:28:17 +0000 |
| Subject: | Re: odbc_fetch_row() | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-117051@lists.php.net to get a copy of this message | ||
Found the workaround to the problem.
It had to be a PHP bug because odbc_fetch_row() should return true if there
is 1 row, not false. I also file a PHP bug at bugs.php.net, the bug number
is 19528.
Here's the workaround I made, I added "$bug_workaround" to the script.
--clip--
$cid = odbc_connect('blah blah blah');
$ask7 = "SELECT * FROM INQUIRIES WHERE USER_ID = '38SCK3'";
$R7 = odbc_exec($cid,$ask7);
$result = odbc_result($R7,1);
echo "Result or No Result??? --> ".odbc_fetch_row($R7);
$bug_workaround=0;
//while (odbc_fetch_row($R7))
while (odbc_fetch_row($R7,++$bug_workaround))
{
odbc_fetch_into($R7,$inquiry,$inq_c);
echo $inquiry[0], $inquiry[1];
}
--clip--"Scott Fletcher" <scott@abcoa.com> wrote in message
news:20020920160040.75550.qmail@pb1.pair.com...
> Hi Fellas!
>
> I'm a little bit confused as to why does this not work right! It had to
do
> with the odbc_fetch_row() function. When there is two or more rows, the
> odbc_fetch_row() return a True. When there's no row, the odbc_fetch_row()
> return a False. What so odd about it is when there is one row,
> odbc_fetch_row() return a False. It should return a True. This doesn't
> make sense. Is this a bug? Have anyone encountered this problem?? What
is
> the workaround to it?
>
> Thanks!
>
> --clip--
> $cid = odbc_connect('blah blah');
> $ask7 = "SELECT * FROM INQUIRIES";
> $R7 = odbc_exec($cid,$ask7);
> $result = odbc_result($R7,1);
>
> while (odbc_fetch_row($R7))
> {
> odbc_fetch_into($R7,$inquiry,$inq_c);
> echo $inquiry[0], $inquiry[1];
> }
> --cilp--
>
>