Limiting results to first 20 results, then next 20, then...
Moderator: General Moderators
Re: Limiting results to first 20 results, then next 20, then...
1) Can you copy the URL of the link?
2) On page 1, can you copy and paste the links?
2) On page 1, can you copy and paste the links?
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Limiting results to first 20 results, then next 20, then...
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....
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....
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Limiting results to first 20 results, then next 20, then
A few things here.
1. Variable names are case-sensitive. These two lines do not reference the same variable.
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.
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> ";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.
Last edited by McInfo on Tue Jun 15, 2010 10:18 pm, edited 1 time in total.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Limiting results to first 20 results, then next 20, then...
Sorry, I'm not quite with you.
Are these written wrongly?
Are these written wrongly?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Limiting results to first 20 results, then next 20, then
What are you referring to by "these"?
Edit: This post was recovered from search engine cache.
Edit: This post was recovered from search engine cache.
Last edited by McInfo on Tue Jun 15, 2010 10:18 pm, edited 1 time in total.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Limiting results to first 20 results, then next 20, then...
The variables you highlighted.
I am responding to what you have quoted.
I am responding to what you have quoted.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Limiting results to first 20 results, then next 20, then
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.
Edit: This post was recovered from search engine cache.
Last edited by McInfo on Tue Jun 15, 2010 10:19 pm, edited 1 time in total.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Limiting results to first 20 results, then next 20, then...
But wasn't that your code.... with a slight change that you suggested?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Limiting results to first 20 results, then next 20, then
You were talking to Raph. Then I butted in.
Edit: This post was recovered from search engine cache.
Edit: This post was recovered from search engine cache.
Last edited by McInfo on Tue Jun 15, 2010 10:19 pm, edited 1 time in total.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Limiting results to first 20 results, then next 20, then...
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.
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.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Limiting results to first 20 results, then next 20, then
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.
On line 101, $pagenum should be $page.
Edit: This post was recovered from search engine cache.
Last edited by McInfo on Tue Jun 15, 2010 10:19 pm, edited 1 time in total.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Limiting results to first 20 results, then next 20, then...
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....?
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....?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Limiting results to first 20 results, then next 20, then...
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:But wasn't that your code.... with a slight change that you suggested?
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:4 - 8 are blank.... why would it give the option of 4 - 8....?
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.simonmlewis wrote:I have had another look at the pagenum's... and pageNums if you like, but cannot see the error.
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.
-
simonmlewis
- DevNet Master
- Posts: 4435
- Joined: Wed Oct 08, 2008 3:39 pm
- Location: United Kingdom
- Contact:
Re: Limiting results to first 20 results, then next 20, then...
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?
Do you mean one ought to be $pagenum and the other $pagenumber... so it's totally different?
Which part do you need - the contents of the query? (echo "select....") ?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.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
All the best from the United Kingdom.
Re: Limiting results to first 20 results, then next 20, then...
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.
=
$maxPage
$numrows
$rowsPerPage
Echo them out on row 88.