Re: LIMIT

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





chris smith wrote:
On 7/1/06, Dwight Altman <dwight@xxxxxxxxxxxx> wrote:

Thanks, but that's an additional query.

I was wondering if there may be a PHP function that can operate on the
$result or perhaps $link of the single query that uses a LIMIT clause and

I'm not sure how this would be done in PHP (simply because I am not a PHP coder) but in Perl (as an example of the principle, so please keep your flames at bay for th etime being ;p) I'd do this:

 my $results_arrayref = $dbh->selectall_arrayref($query);

 my $number_of_results = @{ $results_arrayref };

 print "Number of results: $number_of_results\n";

 for my $record( @{ $results_arrayref } ) {

     # do what you want with each record...
 }

I'm sure PHP has a way to count how many is in a given result set without needing an additional query.

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux