Jump to content

[SOLVED] How would you do forum topic replies?


DrRobot

Recommended Posts

ok, so i got a user system awhile ago on the web and i've been editing it extremely, now i am making a forum, and i got it so it will display the topics, and the threads created, but i can't get it to update the replies in each topic and thread.

 

how would i do this?

Link to comment
Share on other sites

I don't see how this has anything to do with OOP.

 

You need to store all the replies in a separate table, set the table up like this:

 

TABLE "replies"
---------------
replyID (Primary Key)
topicID (The topic they are posting the reply on)
poster (Who is posting the topic)
body (the actual reply)

 

Then you can just make a simple query grabbing the replies for that topic.

 

SELECT reply, poster FROM replies WHERE topicID='$topicID'

 

Does that make enough sense?

 

 

 

Link to comment
Share on other sites

no, i have my functions in classes.

 

and i want to know how you would go about updating the current amount of replies in a thread, such as this one, like when you are looking at the OOP help thread it says 2 replies next to my thread (now three)

 

i have a function that is supposed to update it, but it doesn't...

 

code:

function updateTopicTime($id){
      $day = date("Y-m-d");
      $time = date("g:i:s A");
      $q = "UPDATE ".TBL_TOPICS." SET time = '$time', date = '$day', threads += '1' WHERE fid = '$id'";
      mysql_query($q);
   }
   function addNewForumThread($fid, $topic, $uname, $text){
      $day = date("Y-m-d");
      $time = date("g:i:s A");
      $this->updateTopicTime($fid);
      $q = "INSERT INTO ".TBL_THREADS." VALUES ('$fid', '', '$topic', '$uname', '$text', '$day', '$time', '')";
      mysql_query($q, $this->connection);
   }

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.