RE: [PHP] odbc_num_rows always returnes -1
| From: | John W. Holmes | Date: | Sat, 19 Oct 2002 18:58:23 +0000 |
| Subject: | RE: [PHP] odbc_num_rows always returnes -1 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120619@lists.php.net to get a copy of this message | ||
> I've got the following code, and regardless if it finds something or
not
> odbc_num_rows returns -1 as the value? curious what I should I use to
> test
> whether or not something was found? (the database I am connecting to
is
> Informix running on a different server)
>
> $sql = odbc_exec($$ntslink,"SELECT lot_card_num_k AS pin,
current_balance
> AS
> balance, first_use_date AS first, lot_num_f AS batch, status_flag AS
> status,
> zombie_date AS expired, sequence_number AS serial, zombie_method AS
reason
> FROM lot_card WHERE lot_card_num_k = '$pin';") or
> die("Invalid ODBCQuery");
> $numrows = odbc_num_rows($sql) if ($numrows <= 0 )
Maybe something like this?
if($row = odbc_fetch_array($sql))
{
do{
//process rows
}while($row = odbc_fetch_array($sql));
}
else
{
echo "no rows returned";
}
---John Holmes...