|
|
sybperl-l Archive
Up Prev Next
From: Michael Peppler <mpeppler at peppler dot org>
Subject: Re: NULL values from a table
Date: Jan 26 2000 5:51PM
Jamie Belanger writes:
> Following is a portion of a script I wrote which counts the number of active
> calling cards for each of our accounts. However, I run into a problem when
> the account HAS no active cards (ie, when the select count(*) returns what
> looks like 0). What happens is that the next time the while loop executes, I
> get an error stating that I can't proceed until all fetchable results are
> processed. Here's an example of my error output:
You are assigning an array (returned by ct_fetch) to a scalar. If
there are no results that value will be 0.
> while ($tally = $X->ct_fetch)
> {
> $count = "$tally\n";
> }
This should be changed to:
while(@tally = $X->ct_fetch) {
$count = "$tally[0]\n";
}
This *should* fix your problem.
Michael
--
Michael Peppler -||- Data Migrations Inc.
mpeppler@peppler.org -||- http://www.mbay.net/~mpeppler
Int. Sybase User Group -||- http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com
|