DrRobot Posted September 10, 2007 Share Posted September 10, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/68740-solved-how-would-you-do-forum-topic-replies/ Share on other sites More sharing options...
Daniel0 Posted September 10, 2007 Share Posted September 10, 2007 What do you mean? "Update the post the replies"? Quote Link to comment https://forums.phpfreaks.com/topic/68740-solved-how-would-you-do-forum-topic-replies/#findComment-345604 Share on other sites More sharing options...
pocobueno1388 Posted September 10, 2007 Share Posted September 10, 2007 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? Quote Link to comment https://forums.phpfreaks.com/topic/68740-solved-how-would-you-do-forum-topic-replies/#findComment-345607 Share on other sites More sharing options...
DrRobot Posted September 10, 2007 Author Share Posted September 10, 2007 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); } Quote Link to comment https://forums.phpfreaks.com/topic/68740-solved-how-would-you-do-forum-topic-replies/#findComment-345621 Share on other sites More sharing options...
Daniel0 Posted September 10, 2007 Share Posted September 10, 2007 Change it to $q = "UPDATE ".TBL_TOPICS." SET time = '$time', date = '$day', threads=threads+1 WHERE fid = '$id'"; Quote Link to comment https://forums.phpfreaks.com/topic/68740-solved-how-would-you-do-forum-topic-replies/#findComment-345633 Share on other sites More sharing options...
DrRobot Posted September 10, 2007 Author Share Posted September 10, 2007 Change it to $q = "UPDATE ".TBL_TOPICS." SET time = '$time', date = '$day', threads=threads+1 WHERE fid = '$id'"; YES!! thank you!! it works perfectly now! thank you very much! Quote Link to comment https://forums.phpfreaks.com/topic/68740-solved-how-would-you-do-forum-topic-replies/#findComment-345638 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.