473,466 Members | 1,408 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Pagination error in phpbb - desperate for help!

I've posted my query at the phpbb forum, where I got half an answer and then
no more. I posted it again at another phpbb forum, where I got half an
answer and no more. I posted it in alt.php, where I got half an answer, then
no more.

In desperation, I'm now posting again in alt.php, alt.comp.lang.php and
comp.lang.php in the hope that someone will find the time to help.

This was my original query:

*****
I've got 5 Categories, 20 forums in all.

Three of them show "Page 1 of 0" at the bottom and "GotoPage" at top and
bottom. The forums are all very lightly populated with posts - two have only
one post each, one has four.

I've tried re-synching them, but no good.

They were all forums where some previous posts were created and then deleted
when testing the board before going live - could this be part of the
problem? Will it correct itself when a certain number of posts have been
made into them? Is there anything I can do now to correct it?

*****

The first (and only) reply I got was:

***

if you have deleted the posts manually using sql query, then you haev to
update the phpbb_forums table too, where it keeps track of the number of
posts and topics, try changing that and see

***

To which I replied:

*****

The posts were deleted using the Moderator Control Panel. Don't know if
that's what you mean by deleting them manually using sql query.

I've just installed phpMyAdmin, and can now see a host of features new to
me. Rather confusing. I've only been using php for a month. Can you suggest
what I should do to update the phpbb_forums table? I assume it's something I
can do in phpMyAdmin.

*****

To which there was no further reply. At the other forum, where I posted the
same original question, I was asked what software versions I was using. I
provided the answers. No further reply.

I'm using:

phpbb 2.0.6
phpMyAdmin 2.5.4

My ISP is running:

php 4.3.2
MySQL 4.0.15a

The first reply I got in alt.php was:

"And have you tried updating the phpbb_forums table then?"

To which I replied:

"Well, that's what I'm asking - how to do this. So the answer's no. Because
I don't know how to. How would you do it?"

The reply was:

***** *****

I don't have to do it, cause i wrote my own forum ;)

But anyway, i'm bored so i download the phpBB2 source.

First i looked under the db directory but that seems to contain database
astraction layer implementations.

Then i thought, hey, the man is having problems with the forum view, so i'll
have a look viewforum.php The first thing i read in that code: $sql =
"SELECT * FROM " . FORUMS_TABLE . " WHERE forum_id = $forum_id"; Bingo! this
must be the right place.

A little further i notice (line 246): $sql = "SELECT COUNT(t.topic_id) AS
forum_topics FROM " ...
I wonder: Do they know about JOIN? Hell, it's their code.

I guess includes/funtions_post.php is a good start, cause here you can read
what happens when someone posts. Upto you to find out which tables/rows
haven't been updated.

Next i really would like to know about their databasedesign, and i end up in
install/mysql_schema.sql.

Have a look at the phpbb_forums table, cause my guess is that there you need
to change some values.

Darn they alreay said that at phpbb, so i'll be more precise: Have a look at
following columns of the table because here is where your problem is:

forum_status tinyint(4) DEFAULT '0' NOT NULL,
forum_order mediumint(8) UNSIGNED DEFAULT '1' NOT NULL,
forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,

So what you need to do:
(Make a backup of your database, so you don't feel like killing me in case
something goes wrong)

Foreach forum in phpbb_forums:
-) Get the number of posts that belong to a forum from phpbb_posts
select count(*) as count from phpbb_posts where forum_id=$forum_id
update phpbb_forums set forum_posts=$count where forum_id=$forum_id
-) Get the number of topics that belong to a forum from phpbb_topics
select count(*) as count from phpbb_topics where forum_id=$forum_id
update phpbb_forums set forum_posts=$count where forum_id=$forum_id

Done.

***** *****

To which I replied:

***** *****

Thanks for taking the time to reply.

Unfortunately, I'm still not clear on *where* I'm supposed to do what you
advise me to do, or how to go about it.

When I log into to my database using phpMyAdmin, I can see "phpbb_forums"
listed amongst the files in the left-hand frame. When I click it, in the
main frame I see "Database [mydatabasename] - Table phpbb_forums running on
[servername]". The selected tab at the top is "Structure". There's a list of
21 fields, including the four you mentioned -

forum_status tinyint(4) DEFAULT '0' NOT NULL,
forum_order mediumint(8) UNSIGNED DEFAULT '1' NOT NULL,
forum_posts mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,
forum_topics mediumint(8) UNSIGNED DEFAULT '0' NOT NULL,

Down the bottom of the frame I see a text input box titled "Run SQL
query/queries on database [mydatabasename]". In the input box it says:

"SELECT * FROM `phpbb_forums` WHERE 1"

and this looks similar to the syntax you've used - so is this where I type
in the instructions you've provided? That is to say: do I type in -

select count(*) as count from phpbb_posts where forum_id=$forum_id

- and click "Go"?

Do I then type in the next line of your advice -

update phpbb_forums set forum_posts=$count where forum_id=$forum_id

- and click "Go"?

Do I follow this with -

select count(*) as count from phpbb_topics where forum_id=$forum_id

- and click "Go", followed by -

update phpbb_forums set forum_posts=$count where forum_id=$forum_id

- and click "Go"?

Sorry to be so dense, but php and SQL is very new to me.

***** *****

No further reply has been forthcoming.

Please - any help in clarifying what I must do and how I should do it will
be much appreciated.

Thanks.

BK

Jul 17 '05 #1
0 1869

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Somerset Bob | last post by:
I've posted my query at the phpbb forum, where I got half an answer and then no more. I posted it again at another phpbb forum, where I got half an answer and no more. I posted it in alt.php, where...
2
by: Somerset Bob | last post by:
I've got pagination errors in a phpBB board. Some forums are showing "page 1 of 0". Previous enquiries both here and at the phpBB forum have given me half-answers, the latest of which contained...
2
by: Chris H | last post by:
I am having a problem with pagination, basically the problem is happening in the "PREV / NUMBERS / NEXT" links, it appears as if the reason is becasue the increment and decrement operators aren't...
11
by: ste | last post by:
Hi there, Further to my recent posts where I've received excellent help from Rik and Jerry, I've ended up with an image gallery on my website that displays images in a table, 3 images per row. ...
1
by: selvamcbe | last post by:
sir I have a problem with installtion of phpbb 2 Forum in my website... I am having a website named http://www.clickonlinejobs.com Also i plan to include forum with it.So i have added my forum in...
1
by: shalini jain | last post by:
Hi, I want to know how can we do pagination using XSL. There are number of tutorials available on pagination using PHP but nothing with XSL. i am really stuck with my code. Below is the code that...
9
by: simple12 | last post by:
Hello I have a script which have the facility of entering any code to some part of a webpage. I have some problems with it. When i put some code in the script then their is no error shown. When i...
16
by: gnawz | last post by:
I have a pagination function I am using in a file called functions.php as below<? //Pagination functions function getPagingQuery($sql, $itemPerPage = 10) { if (isset($_GET) && (int)$_GET > 0) ...
2
by: kkshansid | last post by:
this is my search page on which i am getting two parameters from previous page but the problem is that as soon as i click any other next pages my sql query fails as it doesnt get these two parameters...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.