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


Groups > comp.lang.php > #16823

Re: Limit "most popular" to 100

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!weretis.net!feeder1.news.weretis.net!news.solani.org!.POSTED!not-for-mail
From "Christoph M. Becker" <cmbecker69@arcor.de>
Newsgroups comp.lang.php
Subject Re: Limit "most popular" to 100
Date Mon, 4 Jul 2016 18:11:26 +0200
Organization solani.org
Lines 29
Message-ID <nle1r1$d23$1@solani.org> (permalink)
References <super70s-BB47CD.10383304072016@boina.datemas.de> <fQvez.67639$F_5.10789@fx23.iad>
Mime-Version 1.0
Content-Type text/plain; charset=utf-8
Content-Transfer-Encoding 7bit
X-Trace solani.org 1467648673 13379 eJwNyMkBgDAIBMCWxD2QcqKB/kuI8xzB4S9pmRoNUM1Yhcc9DDkDwRUt6XXdWxeVf3b3xq4D+3cQHg== (4 Jul 2016 16:11:13 GMT)
X-Complaints-To abuse@news.solani.org
NNTP-Posting-Date Mon, 4 Jul 2016 16:11:13 +0000 (UTC)
User-Agent Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1
X-User-ID eJwFwQERADEIAzBL7KA8Lwfo6l/CEnie3C8SGRCkn0FTGVjsLXTPpSPuurinx8fDh7uSwh5CzRLU
In-Reply-To <fQvez.67639$F_5.10789@fx23.iad>
Cancel-Lock sha1:PbvXdLIoJe7RoICy76LDzuplxh4=
X-NNTP-Posting-Host eJwNwgkRwEAIBDBL/KwdOMC/hHYS1+B4aeFhfr/NPbS9TQIUK00JnlZyPpEUdKLKbOp8+gMbsBE3
Xref csiph.com comp.lang.php:16823

Show key headers only | 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