Author Topic: mysql basic forum help deleteing inactive threads  (Read 142 times)

0 Members and 1 Guest are viewing this topic.

Offline turkmanTopic starter

  • Enthusiast
    • View Profile
mysql basic forum help deleteing inactive threads
« on: February 28, 2010, 02:06:04 PM »
Hey guys ive probably set my basic forum up badly but i wanted to keep it as simple as possible. Basically the forum is as follows.

ID (int)
ReplyToo (int)
image (varchar 200)
message (txt)
Lastpost datetime
ipaddr (varchar 200)

Basically when someone creates a new thread it gets an auto id and the replytoo status is set to 0 to let me know its not a reply.

When every a reply is made it will have its own id and the replytoo value will be the id of the thread its a reply too. Also whenever a reply is made it will look up the first post (the one its replying too) and set the lastpost value of that to the same as the lastpost of its replies.

Now here is where the problem comes in. I'm looking to add a prune function. I basically want to keep the 100 most recently commented on threads.

The problem being that i have to somehow check the ids laspost but then make sure anything that has a replytoo value the same as the id isnt deleted.

so basically its not the 100 most recent posts kept... its the 100 most recent threads kepts with all their posts.

Offline fenway

  • MySQL Si-Fu / PHP Resident Alien
  • Global Moderator
  • 'Insane!'
  • *
  • Gender: Male
    • View Profile
Re: mysql basic forum help deleteing inactive threads
« Reply #1 on: March 01, 2010, 05:08:51 PM »
You're talking about storing hierarchical data -- not trivial, many tutorials around, including on the stickyl
:anim_rules: Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

PHP Freaks Forums

« on: »

Tired of these ads? Purchase a supporter subscription to get rid of them.