The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
#1
|
|||
|
|||
Pagination help
I'm trying to query the vbulletin database on a custom table, and paginate the results. From the code I have, for some reason it only returns 40 total results. I'm having trouble with the $total_results part, can anyone help me out?
Thanks. PHP Code:
|
#2
|
|||
|
|||
No one??
|
#3
|
||||
|
||||
this should get you in the right direction: NOTE: change the QUERY as I changed it to do a test
PHP Code:
|
#4
|
|||
|
|||
Thanks for the response. I tried your code and it looks like it's working fine.
Can you explain what this part is doing? PHP Code:
Thanks again! |
#5
|
||||
|
||||
PHP Code:
if you study the vb files or any product/plugin found here (vb.org) you will find the above line more frequently This: PHP Code:
PHP Code:
|
#6
|
|||
|
|||
Ok thanks for the tip!
I was just trying the code again, and for some reason it's only showing a certain amount of rows. The table that I'm querying should be showing 65 results (rows), but it always stops at 40. I have it set for 10 results per page, and it keeps showing only 4 pages, so 40 rows. I ran my query in PHPMyAdmin and it works fine, so it's got to be the pagination with vbulletin. Any ideas as to why that would be happening? Even the query from your code, it seems to work, but it shows 5 results per page, 6 pages total. That doesn't seem right. |
#7
|
||||
|
||||
the code was meant to be a starting point for you
|
#8
|
|||
|
|||
Yeah I know but that's the main problem I was having originally, only showing a certain amount of results. I was just wondering if you had an idea as to why it would be doing that.
Thanks though. |
#9
|
||||
|
||||
I edited the above code.
try $from = ($vbulletin->GPC['page'] - 1) * $max_results; |
#10
|
|||
|
|||
The new code you posted works great except for one thing. This works:
$from = (($page * $max_results) - $max_results); Not this one: $from = ($vbulletin->GPC['page'] - 1) * $max_results; Thanks for all the help! So glad I got this working. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|