in reply to Re: Count Number of rows retrieved from SELECT
in thread Count Number of rows retrieved from SELECT

I was hoping not to have to do another SELECT statment just to get the number of rows that was pulled with the first statement.
Oh well... will continue to play, there must be a way
  • Comment on Re^2: Count Number of rows retrieved from SELECT

Replies are listed 'Best First'.
Re^3: Count Number of rows retrieved from SELECT
by monarch (Priest) on Jun 13, 2005 at 12:13 UTC
    Can you include a counter (this is how I've done it in the past..)?
    my $count = 0; while ( my $row = $sth->fetchrow_arrayref() ) { $count++; # do something with $row.. } print( "There were $count row(s)\n" );

    I know what you're asking and it's a worthy question, I just haven't tried working it out for myself because I've just used either of the two techniques I've mentioned instead.

      thanks monarch... I will use that .... should have thought of that earlier!!! thanx