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...
Bastien
From: "JupiterHost.Net" <mlists@xxxxxxxxxxxxxxx>
To: php-db@xxxxxxxxxxxxx
Subject: Re: LIMIT
Date: Sat, 01 Jul 2006 10:59:02 -0500
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
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php