Previous Thread
Next Thread
Print Thread
Rate Thread
#269919 02/26/2004 12:35 PM
Joined: Sep 2003
Posts: 16
Newbie
Newbie
Offline
Joined: Sep 2003
Posts: 16
Due to my user table getting corrupted several times throughout the years, I have many posts that are orphaned because the user associated with them was lost from the user table.

How can I clean this up? If I simply delete all the posts from these non-existent users, will that screw up the forum? Any help with this matter would be greatly appreciated.

Sponsored Links
Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
If you delete random posts using a SQL command, you will orphan many other posts that potentially tie to the ones you just deleted.

Joined: Sep 2003
Posts: 16
Newbie
Newbie
Offline
Joined: Sep 2003
Posts: 16
Is there any way to fix this then? The posts with no user connected to them don't even show up.

It seems that whenever I have a problem, it is with the User table, and when I repair the table it always loses a couple of rows. Sometimes I can restore the users that are lost, but sometimes I don't know which users were lost.

Joined: Mar 2000
Posts: 528
Junior Member
Junior Member
Offline
Joined: Mar 2000
Posts: 528
You could probably write a query that would assign these orphaned posts to B_PosterId='1' (which is the DONOTDELETE Anonymous gump).

The issue you would face is gleaning all the specific posts that are orphaned.

Joined: Aug 2000
Posts: 1,609
Addict
Addict
Offline
Joined: Aug 2000
Posts: 1,609
If the problem is indeed that the posts do not have a Poster ID assigned to them, then the following query should work:
Code
<br />UPDATE w3t_Posts<br />SET B_PosterID = '1'<br />WHERE B_PosterID = ''<br />


*Always take care and backup your database before attempting queries you are not 100% sure about.*

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
That won't work - because probably those posts have a usernumber already associated with them - however that user doesn't exist.

What you need to do - is recreate the missing users (with the correct number) which will make them reappear.

There was a recent post here - where I posted a script which cycles through all your posts and lists all your missing users.

Let me find that post.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
This thread will help you - about 4 or 5 posts down - I post the script that'll check for missing users.

https://www.ubbdev.com/forum/showflat.php?Cat=0&Number=106554

Daine #269926 02/27/2004 11:37 AM
Joined: Sep 2003
Posts: 16
Newbie
Newbie
Offline
Joined: Sep 2003
Posts: 16
Thanks Josh! It lists my missing users...but how do I know who they were to recreate them? I might me able to find some of these users from old backups...but I think that many of them are gone forever. I guess I could just make up names for them so at leasts the posts will show up.

Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
Yeah, what you need to do is register a user - then change that user's number.

UPDATE w3t_Users
SET U_Number = xxxx
WHERE U_Username = 'yyyyyyyy'


Or - you can set those posts to anonymous - so if you know user #506 is missing, you can do a query like this:

UPDATE w3t_Posts
SET B_PosterId = 1,
B_Reged = 'n'
WHERE B_PosterId = 506


That'll set all posts by #506 to an anonymous post.

Hope that helps.

Joined: Sep 2003
Posts: 16
Newbie
Newbie
Offline
Joined: Sep 2003
Posts: 16
My user table got corrupted AGAIN today. This seems to be happening a lot lately. Is there any reason you guys know of why this would suddenly start happening frequently?

Sponsored Links
Joined: Nov 2001
Posts: 10,369
I type Like navaho
I type Like navaho
Joined: Nov 2001
Posts: 10,369
This is generally trouble with MySQL or the MySQL configuration. If your server is overloaded or MySQL isn't configured correctly this will happen.

Joined: Nov 2002
Posts: 554
Code Monkey
Code Monkey
Offline
Joined: Nov 2002
Posts: 554
A longshot..when my user table got corrupted I found I had a bad sector on the Hard Drive..Hard Drive went out shortly thereafter

Joined: Oct 2003
Posts: 2,305
Old Hand
Old Hand
Joined: Oct 2003
Posts: 2,305
[]ChAoS said:
A longshot..when my user table got corrupted I found I had a bad sector on the Hard Drive..Hard Drive went out shortly thereafter [/]

so in other words BACKUP NOW!


Link Copied to Clipboard
Donate Today!
Donate via PayPal

Donate to UBBDev today to help aid in Operational, Server and Script Maintenance, and Development costs.

Please also see our parent organization VNC Web Services if you're in the need of a new UBB.threads Install or Upgrade, Site/Server Migrations, or Security and Coding Services.
Recommended Hosts
We have personally worked with and recommend the following Web Hosts:
Stable Host
bluehost
InterServer
Visit us on Facebook
Member Spotlight
Bill B
Bill B
Issaquah, WA
Posts: 87
Joined: December 2001
Forum Statistics
Forums63
Topics37,573
Posts293,925
Members13,849
Most Online5,166
Sep 15th, 2019
Today's Statistics
Currently Online
Topics Created
Posts Made
Users Online
Birthdays
Top Posters
AllenAyres 21,079
JoshPet 10,369
LK 7,394
Lord Dexter 6,708
Gizmo 5,833
Greg Hard 4,625
Top Posters(30 Days)
Top Likes Received
isaac 82
Gizmo 20
Brett 7
WebGuy 2
Morgan 2
Top Likes Received (30 Days)
None yet
The UBB.Developers Network (UBB.Dev/Threads.Dev) is ©2000-2024 VNC Web Services

 
Powered by UBB.threads™ PHP Forum Software 8.0.0
(Preview build 20240430)