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


Groups > comp.lang.php > #16717

Re: Pagination isn't working

From "J.O. Aho" <user@example.net>
Newsgroups comp.lang.php
Subject Re: Pagination isn't working
Date 2016-04-03 10:30 +0200
Message-ID <dmc2lkFt3liU1@mid.individual.net> (permalink)
References <super70s-3A8AC1.16045102042016@boina.datemas.de>

Show all headers | View raw


On 04/02/2016 11:04 PM, super70s wrote:
> I have a little PHP article directory script with pagination at the 
> bottom, but it isn't working when you click on pages 2, 3, 4, etc., -- 
> it always shows the same 10 entries on the first page. Anyone have an 
> idea how I can fix this?
> 
> </table><font class=bodylinks>Go To Page :
> &nbsp; [1]
> &nbsp;<a href="?pg=2&page=category&category_id=86" 
> class=bodylinks><strong>2</strong></a>
> &nbsp;<a href="?pg=3&page=category&category_id=86" 
> class=bodylinks><strong>3</strong></a>
> &nbsp;<a href="?pg=4&page=category&category_id=86" 
> class=bodylinks><strong>4</strong></a>
> 

you need to add $this->ps to the variable you use for setting the ?pg=

> if (!empty($_GET["ps"]))
>         $this->ps = (int) $_GET["ps"];
>      else
>         $this->ps = 50;

I wouldn't use empty() to verify that the user input is correct, use a
regular expression or in worst case is_numeric() to validate the input.


-- 

 //Aho

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


Thread

Pagination isn't working super70s <super70s@super70s.invalid> - 2016-04-02 16:04 -0500
  Re: Pagination isn't working Richard Yates <richard@yatesguitar.com> - 2016-04-02 17:12 -0700
    Re: Pagination isn't working super70s <super70s@super70s.invalid> - 2016-04-02 20:08 -0500
      Re: Pagination isn't working "R.Wieser" <address@not.available> - 2016-04-03 09:46 +0200
        Re: Pagination isn't working super70s <super70s@super70s.invalid> - 2016-04-03 14:05 -0500
          Re: Pagination isn't working "R.Wieser" <address@not.available> - 2016-04-03 23:09 +0200
      Re: Pagination isn't working Arno Welzel <usenet@arnowelzel.de> - 2016-04-04 11:35 +0200
        Re: Pagination isn't working "R.Wieser" <address@not.available> - 2016-04-04 12:44 +0200
  Re: Pagination isn't working "J.O. Aho" <user@example.net> - 2016-04-03 10:30 +0200

csiph-web