News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

Missing Post in Forum but still in Database

Started by zinga4, June 09, 2020, 07:03:37 AM

Previous topic - Next topic

zinga4

Hi People,

I searched the forum and goggled for the following problem but was not able to solve it:

Using XAMPP (Version from 2012) and SMF Forum 2.0.4 on my private PC.
Noticed missing thread in forum.
But topic plus four answers are still in the database.
Board-Number is correct and it is not locked.
I am afraid, that I will lose more threads in the future.

I use some packages and searched for topics like "missing thread but visible in database" and "locked" or "hidden".

I tried to open the topic with the URL plus the ID
... index.php?topic=6.0
With other IDs from the Database this worked but with this ID the message is:
"An Error Has Occurred! This topic doesn't exist on this board."

If I export the database-entry I see the attachements in the topic but I get an Error Message when I try to load the attachment via direct url
...index.php?action=dlattach;topic=6.0;attach=852
An Error Has Occurred!
You are not allowed to access this section

But I am the only member and admin
(I created and deleted new users with and without admin rights to see if they can see the topic - no success)

Packages I use:
Expanding & Collapsing Spoiler Tag    1.8
SimplePortal    2.3.5    
Tagging System SMFSIMPLE    1.1
SMF Search Enhancement Mod    1.8.2

I would appreciate where to start my analysis or what to search for.
I am no programmer but I can execute SQL Queries and have a simple understanding of databases (pk, fk, datatypes) and my husband helped me to look at the database.

Admin ErrorLog is empty

Thank you for your effort to answer me. Any hint is welcome.

Greetings,

Z.

Gary

You can have SMF attempt to find and repair any errors like that by going Admin > [Maintenance] > Forum Maintenance > Find and repair any errors.

It should create a new board where any orphaned topics would appear for you to move around as appropriate.
Gary M. Gadsdon
Do NOT PM me unless I say so
War of the Simpsons
Bongo Comics Fan Forum
Youtube Let's Plays

^ YT is changing monetisation policy, help reach 1000 sub threshold.

zinga4

Thanks. I should have mentioned that I already did that because it was a google search result to do it.
Result of that task "Congratulations, no errors found! Thanks for checking."

I also noticed that the Board says "21 Topics". Inside the boards only 14 are listed on page 1
if I go to page 2 the last item of page 1 is visible again but no more. So
some more topics are already missing.  :-\
(I used the task "recount all forum totals and statistics")

Looking

Have you tried reading it from the database?

Deaks

I would advuse upgrade to 2.0.17 and see if the update fixes it as 2.0.4 is OLD and has a fair few bugs
~~~~
Former SMF Project Manager
Former SMF Customizer

"For as lang as hunner o us is in life, in nae wey
will we thole the Soothron tae owergang us. In truth it isna for glory, or wealth, or
honours that we fecht, but for freedom alane, that nae honest cheil gies up but wi life
itsel."

zinga4

#5
I found an old backup. 11 posts in one board alone are missing compared to my current version. Most of them I do not even miss and already forgot about them.

Databaseentry of message table as xml export of 3 entries look the same in backup and current version (file compare)

Conclusion for me:
I stop using smf because of lost posts and this seems not to be a software for amateurs.

Thank you again for trying to help me.

Arantor

If the data is in the database, it's in the database and the issue is that for some reason it doesn't display, that's a very different proposition to "data is lost".

If you're looking for software that "never" has data loss, don't use any software ever because it's always a possible risk. Always, no matter what software you have.

I'm sorry, I didn't get to this topic in time to be able to help investigate your issue, good luck with your future foruming.
Holder of controversial views, all of which my own.


zinga4

Thank you Arantor.

Quoteto help investigate your issue

What would have been your suggestion?

---
@Deaks
I updated - no change - I only lost all plugins listed above and now getting many error messages in error log because of missing plugins - rolled back

---

@Looking "Have you tried reading it from the database?"
What do you mean exactly? How do i "read it" from the database?
I googled how to find the topic in the messages table and tried export / import / id-change (using xampp I copied the folder as backup and reverted the changes later)

Arantor

So if you have xampp, you have phpmyadmin.

Go to localhost/phpmyadmin, select the database on your machine, look at the smf_topics table, what does it have in it?
Holder of controversial views, all of which my own.


zinga4

#9
Several entries in the table. IDs matching visible boards and topics.

The missing topic id=6 board=1 is also in this table:

smf_topics
             id_topic  6 
             is_sticky  1 
             id_board  1 
             id_first_msg  7 
             id_last_msg  385 
             id_member_started  1 
             id_member_updated  1 
             id_poll  0 
             id_previous_board  0 
             id_previous_topic  0 
             num_replies  4 
             num_views  72 
             locked  0 
             unapproved_posts  0 
             approved  1

this values are different in backup
             is_sticky  0 
             num_replies  19 
             num_views  62 



Today:
index.php?topic=6.0 can not be loaded via url
topics 1-5 are missing in database

Backup:
Topics can be loaded via url
index.php?topic=1.0  (Welcome to smf)
2.0
3.0
4.0
5.0
6.0

Also those topics are in the smf_messages and smf_topics

Current:
Only Topic 6.0 is in the smf_messages.
1.0 to 5.0 are missing


Look, I will stop here because at least 4 topics are missing alltogether in the database. It is easier for me to copy and paste what is left over in the other software I will use  from the databases I have.

Thank you so much for your effort!

Kindred

Well, sorry to see you just give up rather than work through the actual problem.


regarding updating...

if you updated by using the full-upgrade method (overwriting your files) then yes --  you would have to REINSTALL mods (because you overwrote the previously edited files, after al)

If you updated by using the PATCH method, (applying update patches via the package manager to go from one version to the next and then the next, etc) then you would not lose your mods.

https://wiki.simplemachines.org/smf/Patching


As for your original problem report....
the 5 missing posts were probably deleted, if they are not in the database. That's not data LOSS... that's called performing the action requested.
The one post which appears in the database but does not get displayed is another issue entirely and Arantor is probably the best person who could have helped you figure out what was going on with that.

but have fun dealing with whatever new system that you choose, and give up on that the moment you encounter any behavior you don't understand....




Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

zinga4

After years I looked into it again and fixed the problem with SMF Topics not showing up properly, even though they are counted correctly in the database. It's a pretty simple issue, yet surprisingly no one was able to find a solution. But don't worry, I've got your back.

Here's how to fix it:

1. **Check for missing `id_first_msg`**: This can happen if the first message of the topic is deleted or missing.

  SELECT id_topic, id_first_msg, id_last_msg
  FROM smf_topics t
  WHERE NOT EXISTS (
    SELECT 1 FROM smf_messages m WHERE m.id_msg = t.id_first_msg
  );
 

2. **Fix missing `id_first_msg`** by setting it to `id_last_msg` (this is a quick workaround to make the topic visible again):


  UPDATE smf_topics t
  SET id_first_msg = id_last_msg
  WHERE NOT EXISTS (
    SELECT 1 FROM smf_messages m WHERE m.id_msg = t.id_first_msg
  );


3. **Check for missing `id_last_msg`** (same principle as the first message):

  SELECT id_topic, id_first_msg, id_last_msg
  FROM smf_topics t
  WHERE NOT EXISTS (
    SELECT 1 FROM smf_messages m WHERE m.id_msg = t.id_last_msg
  );
 

4. **Fix missing `id_last_msg`**:

  UPDATE smf_topics t
  SET id_last_msg = id_first_msg
  WHERE NOT EXISTS (
    SELECT 1 FROM smf_messages m WHERE m.id_msg = t.id_last_msg
  );


While this might seem like a straightforward issue, it's interesting how many people missed this simple fix. I hope this helps the rest of you. You're welcome.

Enjoy your now-visible topics!

I used smf with XAMPP to note some stuff.

While this solution should help you fix the missing topics in SMF, I'd like to add a little side note. SMF, like many other self-hosted software solutions, is great when it works. But it's important to remember: when it comes to storing important information, it's hidden away in a database that you might struggle to access or migrate later.

In fact, the issue here highlights why relying on a private web server for storing critical data can be risky. After a few years, software like SMF often becomes outdated or complicated to maintain, and moving that data elsewhere can be a real headache.

That's why I prefer tools like Obsidian. They store information in a much more accessible, flexible format and don't lock you into systems that might not age well. There are better solutions out there than relying on old forum software to manage important content.

Just my two cents. Hope this helps!

Kindred

Given that you CAN NOT delete the first post in a topic by any means on the front end,  it seems that you created your own problem...

As for the rest of your commentary...


Meh, you're welcome to your opinion, even if it is silly
Слaва
Украинi

Please do not PM, IM or Email me with support questions.  You will get better and faster responses in the support boards.  Thank you.

"Loki is not evil, although he is certainly not a force for good. Loki is... complicated."

Advertisement: