Subject Re: # of Rows returned by a select?
Author Steve Harp
--- In firebird-php@yahoogroups.com, Lester Caine <lester@l...> wrote:
> Steve Harp wrote:
>
> > I need to determine how many rows were returned by ibase_query() in a
> > select statement (ie select NAME from mytable). The
> > ibase_affected_rows() seems to always return zero with a select and
> > the ibase_query() returns True even when a null result set is
returned.
>
> If you need a count of something, then 'SELECT COUNT( X ) FROM Y WHERE
> Z' to get it, then the query you run into the ibase_query() select can
> be filtered to just provide the subset you actually want to display ;)
>
> I tend to run a COUNT, and follow it with a 'SELECT FIRST 10 SKIP X'
> based on the results of the count. So a total returned by the query is
> not much use :)

It seems odd that you'd have to execute 2 selects for each query in
order to find out it you've received any data. I don't use MySql but
I understand that it offers a function to handle this. Why wouldn't
the ibase* support offer similar capabilities?

Steve