Forum Moderators: coopster

Message Too Old, No Replies

question about the Page Numbering tutorial by PHP Freaks

         

swati

2:36 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



Hello, This is in reference to the Page Numbering tutorial by PHPFreaks.
In this tutorial the "select * from pages limit.." query customized for my needs actually contains a "where site = '".$id."'" clause. This $id changes depending upon a value that the user will select from a drop down on my page and thereafter the page will get refreshed. Hence the number of records returned would also be different. But the mysql_result() function that i have used from the tutorial continuously returns the same number of records while actually the number of records varies according to $id. [lets say mysql_result gives 31 each time though the query filters only 16 or 10 records]

As a result it shows 1 2 3 4 5 6 7 page links each time even though there are not enough records to fill 7 pages ...
Please help ...how should I alter the query....

Salsa

3:06 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



You need to include the same WHERE condition in the mysql_result() query as you did in the first mysql_query(). I'm not sure why they set it up with two independent queries as they did, but they did!

swati

3:22 pm on Nov 18, 2004 (gmt 0)

10+ Year Member



It works now after including the where clause....thanks so much. I will keep coming back with more problems!

Regards
Swati

AndyD

8:36 pm on Nov 21, 2004 (gmt 0)

10+ Year Member



Where can I find a copy of the Page Numbering system mentioned, as I'm looking too use a similar thing in a piece of code and don't want to re-invent the wheel.

Similar thing to the page number used in the bulletin board screen (see below)

Results Pages: [ << Previous 10 11 12 13 14 15 16 17 18 19 20 [ Next >> ]

Salsa

8:53 pm on Nov 21, 2004 (gmt 0)

10+ Year Member



AndyD: I think that when I helped swati I just googled on his keywords. Something like: Page Numbering tutorial PHPFreaks - and the thing he's using came out at the top.

HA! This post is number one now. The actual tutorial is only #2.