Page 6 of 6

Re: Limiting results to first 20 results, then next 20, then...

Posted: Mon Jun 08, 2009 7:30 am
by simonmlewis
Like so?
1 2
index.php?page=categ&menu=categ&category=Battery Operated Toys&pagenum=2

3
index.php?page=categ&menu=categ&category=Battery Operated Toys&pagenum=3

4
index.php?page=categ&menu=categ&category=Battery Operated Toys&pagenum=4

5
index.php?page=categ&menu=categ&category=Battery Operated Toys&pagenum=5

6
index.php?page=categ&menu=categ&category=Battery Operated Toys&pagenum=6

7
index.php?page=categ&menu=categ&category=Battery Operated Toys&pagenum=7

8
index.php?page=categ&menu=categ&category=Battery Operated Toys&pagenum=8

[Next]
index.php?page=categ&menu=categ&category=Battery Operated Toys&pagenum=2

[Last Page]
index.php?page=categ&menu=categ&category=Battery Operated Toys&pagenum=8

Re: Limiting results to first 20 results, then next 20, then...

Posted: Mon Jun 08, 2009 7:32 am
by Raph
No, but that was still very useful. Assuming the script is 'sane', the problem lies with the reported amount of pages it should print, and not with the actual printing (since the system looks like it should for a 8-page system).
Read the second half of my previous post. Hopefully there's a problem with $maxPage.

Re: Limiting results to first 20 results, then next 20, then...

Posted: Mon Jun 08, 2009 7:41 am
by simonmlewis
I rendered the results of numrows and rowsPerPage and this was the result:

Num of Rows: 149
Rows per page: 20

It's wrong though, and it knows it as it only produces about 49 results... not results from 149 rows..??

HOLD ON... i've cracked it....durrr.. :banghead:

This was the error:
$query = "SELECT COUNT(id) AS numrows FROM products WHERE category = '$mycateg' AND stockstatus= 'in stock'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_array($result, MYSQL_ASSOC);
... on line 79 it didn't do the check on the 'category' field in the table. so it was always producing the numrows for EVERYTHING in the table. Can't believe I didn't spot that, but that's when I just checked the calculations.

It now works perfectly. Just a little CSSing to do on it.

Thank you.

Re: Limiting results to first 20 results, then next 20, then...

Posted: Mon Jun 08, 2009 7:45 am
by Raph
I take it that the pages are error-free now. I'm glad you managed to spot the last step by yourself. Anyone who has the brain to troubleshoot, has the brain to make the troubles in the first place. :mrgreen:

Re: Limiting results to first 20 results, then next 20, then...

Posted: Mon Jun 08, 2009 7:52 am
by simonmlewis
[laughs].... very good comment and very true!

It's completely trouble free, so thanks for the 70+ efforts!!!!