Your example predicates that the resultset it passed to an array which you then take the size of, which would only give you the LIMIT value if that clause is specified in the query...


From: "JupiterHost.Net" <[EMAIL PROTECTED]>
Subject: Re: [PHP-DB] LIMIT
Date: Sat, 01 Jul 2006 10:59:02 -0500

chris smith wrote:
On 7/1/06, Dwight Altman <[EMAIL PROTECTED]> 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 (
To unsubscribe, visit:

PHP Database Mailing List (
To unsubscribe, visit:

Reply via email to