Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #16823

Re: Limit "most popular" to 100

From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.php
Subject Re: Limit "most popular" to 100
Date 2016-07-04 18:11 +0200
Organization solani.org
Message-ID <nle1r1$d23$1@solani.org> (permalink)
References <super70s-BB47CD.10383304072016@boina.datemas.de> <fQvez.67639$F_5.10789@fx23.iad>

Show all headers | View raw


On 04.07.2016 at 18:06, Richard Damon wrote:

> On 7/4/16 8:38 AM, super70s wrote:
>
>> (This question is for everyone but R.Wieser)

Nonsense.  This is Usenet.

>> <?while ($rshome = mysql_fetch_array($cmdartcat)) { ?>
>>
>> Is there an easy way to accomplish what I want by modifying this somehow?
> 
> This is more of a mysql issue than a php issue. If you add a limit cause
> to your query, you can limit how many records you receive.

And that's what should be done for performance reasons.

> You could do a php only solution, adding a counter to the loop.
> Something similar to:
> 
> <?$cnt=0;
> while (++$cnt<=100 && $rshome = mysql_fetch_array($cmdartcat)) { ?>

And consider to avoid the mysql extension, which has been deprecated
long ago, and has been removed from the official php.net distribution as
of PHP 7.0.0.

-- 
Christoph M. Becker

Back to comp.lang.php | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Limit "most popular" to 100 super70s <super70s@super70s.invalid> - 2016-07-04 10:38 -0500
  Re: Limit "most popular" to 100 Richard Damon <Richard@Damon-Family.org> - 2016-07-04 09:06 -0700
    Re: Limit "most popular" to 100 "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-07-04 18:11 +0200
    Re: Limit "most popular" to 100 super70s <super70s@super70s.invalid> - 2016-07-05 22:32 -0500
      Re: Limit "most popular" to 100 "Christoph M. Becker" <cmbecker69@arcor.de> - 2016-07-06 14:02 +0200

csiph-web