Well, i thought it was time to investigate this matter. For sure this has to do with database inconsistency.
So i first looked at the topics table :
- Code: Select all
SELECT topic_replies
FROM `phpbb_topics`
WHERE topic_id =2280
This gave me : 1057
Now we check if we have the same data in the phpbb_posts table :
- Code: Select all
SELECT *
FROM `phpbb_posts`
WHERE topic_id =2280
This one gave me 1058 results.
So far all is OK : 1058 posts = 1 post (the initial one) and the 1057 replies (as stated in the topics table)
So the inconsistency must be in the post_text table.
the following query checks if there is a post text (in phpbb_posts_text) for every post referenced in phpbb_posts for the specified topic.
If not it will output the post_id which has no entry in posts_text :
- Code: Select all
SELECT phpbb_posts.post_id, phpbb_posts_text.post_id
FROM `phpbb_posts`
LEFT JOIN phpbb_posts_text ON phpbb_posts.post_id = phpbb_posts_text.post_id
WHERE topic_id =2280
AND phpbb_posts_text.post_id IS NULL
guess what, the query told me that post_id=75583 had no text defined.
So I kicked the post_id=75583 from the phpbb_posts table and changed the topic_replies to 1056 in phpbb_topics and everything runs smooth now.
By the way, such inconsistencies (and many others) can be checked through the entire database with some MODS. For now i only remember one (good one) : database maintenance ( see
http://phpbb.kordowich.net/?pgid=8 ). The only "drawback" (when i tested a long time ago) is that there was no "report only" option. You launch any of the "check xxx" function and changes are applied immediately/automatically without confirmation (but maybe this has changed now). Indeed, the mod is well known and tested, so you can trust it (but always backup first of course

)