Page 5 of 6
Re: Limiting results to first 20 results, then next 20, then...
Posted: Sun Jun 07, 2009 3:52 pm
by Raph
1) Can you copy the URL of the link?
2) On page 1, can you copy and paste the links?
Re: Limiting results to first 20 results, then next 20, then...
Posted: Sun Jun 07, 2009 4:21 pm
by simonmlewis
Hi
You asked a question before about page numbers.
Well one category has 49 items and runs through to three pages. But when you click Next on page three... the next page is titled "3" as well....
Re: Limiting results to first 20 results, then next 20, then
Posted: Sun Jun 07, 2009 4:41 pm
by McInfo
A few things here.
1. Variable names are case-sensitive. These two lines do not reference the same variable.
Code: Select all
// Line 51
$pageNum = $_GET['pagenum'];
// Line 101
$nav .= " <a href=\"index.php?page=categ&menu=categ&category=$mycateg&pagenum=$page\">$pagenum</a> ";
2. $_REQUEST combines $_GET, $_POST, and $_COOKIE.
3. Related topic:
viewtopic.php?p=537019#p537019
4. Displaying paginated random results requires some extra storage. You need to keep track of at least the results' primary keys to maintain the sequence that was returned to the user on the first visit. I recommend that you don't deal with the extra complexity until you completely understand your current obstacle.
Edit: This post was recovered from search engine cache.
Re: Limiting results to first 20 results, then next 20, then...
Posted: Sun Jun 07, 2009 4:52 pm
by simonmlewis
Sorry, I'm not quite with you.
Are these written wrongly?
Re: Limiting results to first 20 results, then next 20, then
Posted: Sun Jun 07, 2009 4:58 pm
by McInfo
What are you referring to by "these"?
Edit: This post was recovered from search engine cache.
Re: Limiting results to first 20 results, then next 20, then...
Posted: Sun Jun 07, 2009 5:02 pm
by simonmlewis
The variables you highlighted.
I am responding to what you have quoted.
Re: Limiting results to first 20 results, then next 20, then
Posted: Sun Jun 07, 2009 5:04 pm
by McInfo
On line 51, $pageNum is written with an uppercase N. On line 101, $pagenum is written with a lowercase N. They do not reference the same value. In fact, $pagenum does not reference any value.
Edit: This post was recovered from search engine cache.
Re: Limiting results to first 20 results, then next 20, then...
Posted: Sun Jun 07, 2009 5:09 pm
by simonmlewis
But wasn't that your code.... with a slight change that you suggested?
Re: Limiting results to first 20 results, then next 20, then
Posted: Sun Jun 07, 2009 5:12 pm
by McInfo
You were talking to Raph. Then I butted in.
Edit: This post was recovered from search engine cache.
Re: Limiting results to first 20 results, then next 20, then...
Posted: Sun Jun 07, 2009 5:16 pm
by simonmlewis
Ok.....?
It's now late so I am retiring for the evening, but will be collecting all messages first thing in the morning.
I have had another look at the pagenum's... and pageNums if you like, but cannot see the error.
The result so far is terrific, which this one vital flaw which is probably thru a loop somewhere not telling the browser how many pages it has in the memory. That might also explain why the 'Next' is enabled where there is no other page there...?
Nite all... till tomorrow.
Re: Limiting results to first 20 results, then next 20, then
Posted: Sun Jun 07, 2009 5:19 pm
by McInfo
I thought I could sneak an extra sentence into my last post before you replied. I guess not, so I'll repeat it.
On line 101, $pagenum should be $page.
Edit: This post was recovered from search engine cache.
Re: Limiting results to first 20 results, then next 20, then...
Posted: Mon Jun 08, 2009 2:20 am
by simonmlewis
Thanks.
For the Battery Operated Toys section, that now displays 1, 2, 3, 4, 5, 6, 7, 8..... where only 1 - 3 are pages contained content.
4 - 8 are blank.... why would it give the option of 4 - 8....?
Re: Limiting results to first 20 results, then next 20, then...
Posted: Mon Jun 08, 2009 6:50 am
by Raph
simonmlewis wrote:But wasn't that your code.... with a slight change that you suggested?
Read the last row of my first post in this thread. It's not my code. You took it from the guide I linked to. I've said it several times, the code works 100% on my system. I supplied it back to you, and then told you to change the table-names and such, and after that it's all been about converting the code back to your software. Every error after that point, has been created on the fly, not before.
simonmlewis wrote:4 - 8 are blank.... why would it give the option of 4 - 8....?
For some reason the script thinks you either have more results than you really have, your loop criterias are wrong, or something else. I'll once again try to ask you to supply the contents of the variables, but this time the ones that influences the contents of the links.
simonmlewis wrote:I have had another look at the pagenum's... and pageNums if you like, but cannot see the error.
You need consistency in your code. Do the changes McInfo suggested. It does not matter if you see the problem or not, you can still use ctrl+F in notepad (or whatever program you are using), and type in "pagenum" (without the quotes), and find the culprits.
Imagine the uppercase alphabet being in red, and the lowercase alphabet being in yellow. When typing "HELLO", it would be in all red, while typing "hello" would be in all yellow. Now mix it like "Hello", and you have a blend of colors in the word. A blend is not the same as one of the other examples, which are plain. $pagenum is plain. $pageNum is a blend. See the difference? You need consistency. Make one, or the other, but not both.
Re: Limiting results to first 20 results, then next 20, then...
Posted: Mon Jun 08, 2009 7:14 am
by simonmlewis
The pagenum and pageNum's were all taken from your code - and I am sure one of you suggested I change it to "num".
Do you mean one ought to be $pagenum and the other $pagenumber... so it's totally different?
For some reason the script thinks you either have more results than you really have, your loop criterias are wrong, or something else. I'll once again try to ask you to supply the contents of the variables, but this time the ones that influences the contents of the links.
Which part do you need - the contents of the query? (echo "select....") ?
Re: Limiting results to first 20 results, then next 20, then...
Posted: Mon Jun 08, 2009 7:17 am
by Raph
No query, but variables. You assign values to variables, and then echo them out where your links ought to be.
=
$maxPage
$numrows
$rowsPerPage
Echo them out on row 88.