Subject Re: Empty Result Set
Author troth1871
--- In firebird-php@yahoogroups.com, "Dan Wilson" <dwilson@d...>
wrote:
> On 12/28/2004 at 1:40 PM troth1871 wrote:
>
> > Hi. I'm just developing a web application using firebird as dbms
and
> > everything is working fine, beside on little problem.
> >
> > Is there any possibility to find out, if an result set returned
by the
> > function ibase_query() is empty, before trying to fetch the data
out
> > of the result set with functions like ibase_fetch_row() ?
> >
> > Thanks a lot for yout help.
> > Thomas Roth
> >
> >
>
> Not that I know of, but I have never seen any kind of performance
problem at all in simply issuing ibase_fetch_row() and checking for
a return value of false. Is there some problem you are having that
makes you wish for such a feature?
>
> Regards,
>
> Dan.

First I want to thank you for your fast reply.

This feature would be very helpful, indeed. I use a standard while
constructions like this one:

$result = ibase_query ( $fbirdlink, $sql);
if ($result)
{ print "....";

while ($this_result = ibase_fetch_row ($result))
{
$ID=$this_result[0];
$VAR1=$this_result[1];
$VAR2=$this_result2];
print "This is a
test!".$ID."#".$VAR1."#".$VAR2;
}
print "</ul>\n";
}
else
{
print "<br>DBMS error or no lines have been
selected<br>\n";
}

The problem with this construction is, that Firefox returns unlike
MySQL a result, even if this result set is empty. There are some
methods to solve this problem, for example you can make a second
ibase_query before you make the original select statement and count
the results and then decide to make the original select statement or
not.

But this solution isn't very - how should I call it? - nice. There
must be a more elegant solution for solving this problem.

As you maybe can see I do not have much experience in programming
PHP and working with Firefox, so I hope you can excuse those dumb
questions which could sound trivial to you, as well as my terrible
english.

Regards,
Thomas