Re: LIMIT
| From: | Bastien Koert | Date: | Sat, 01 Jul 2006 16:31:31 +0000 |
| Subject: | Re: LIMIT | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-42145@lists.php.net to get a copy of this message | ||
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@jupiterhost.net> To: php-db@lists.php.net Subject: Re: [PHP-DB] LIMIT Date: Sat, 01 Jul 2006 10:59:02 -0500 chris smith wrote:On 7/1/06, Dwight Altman <dwight@multicam.com> wrote: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 } ) {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# 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