You are here: Re: Pagination Tutorial « PHP Programming Language « IT news, forums, messages
Re: Pagination Tutorial

Posted by Rik Wasmus on 10/16/07 12:33

On Tue, 16 Oct 2007 13:40:32 +0200, Alec <ajtdds@aol.com> wrote:
> I have recently tried a php tutorial on pagination, but I just cannot
> get the links to work. See www.freeweekends.co.uk/pagtest2.php. The
> search finds over 60 results, but only the first page of ten are
> displayed, with the Prev and Next links not working.
>
> Can anyone help, or has anyone another pagination tutorial?
>
> Thanks
>
> Alec
>
> <?php
> $connection =3D @mysql_connect('localhost', '*****', '*****');
> if (!$connection) {
> echo '<p>Unable to make database connection.</p>';
> exit();
> }
> if (!@mysql_select_db('uks49179')) {
> exit('<p>Unable to locate database.</p>');
> }
>
> $limit =3D 10;
> $query_count =3D "SELECT count(*) FROM companyid_uks49179 WHERE=

> town=3D'Bury St. Edmunds' AND category=3D'sleep' AND priority=3D'0'";
> $result_count =3D mysql_query($query_count);
> $totalrows =3D mysql_num_rows($result_count);

$totalrows here should become FALSE or 1 according to the code, never, =

ever, anything else.

$query_count =3D "SELECT count(*) FROM companyid_uks49179 WHERE =

town=3D'Bury St. Edmunds' AND category=3D'sleep' AND priority=3D'0'";
$result_count =3D mysql_query($query_count);
$totalrows =3D mysql_result($result_count,0,0);


> if(empty($page)){

register_globals should be disabled, and is probably the problem. Or hav=
e =

you filled $page somewhere else?

> $page =3D 1;
> }
>
> $limitvalue =3D $page * $limit - ($limit);

I certainly hope you check $page > 0?
And make sure it's an integer, floats in limit clauses can't be the goal=
:)
-- =

Rik Wasmus

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация