Re: odbc_num_rows always returnes -1
| From: | Jeff Bluemel | Date: | Sun, 20 Oct 2002 03:01:01 +0000 |
| Subject: | Re: odbc_num_rows always returnes -1 | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-120654@lists.php.net to get a copy of this message | ||
thanks John - I'll try it...
"John W. Holmes" <holmes072000@charter.net> wrote in message
news:000701c277a1$83b0fe90$7c02a8c0@coconut...
> > 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...
>
>