alex clone Posted May 21, 2009 Share Posted May 21, 2009 Hey, Do you know how to make it so if someone replys to a topic it will act like a bump and go first? So that when teh site gets popular most new topics dont go to 10th page Topic 2 posted] Topic 1 posted] Someone posts in topic 1 so new order will now be: Topic 1 topic 3 topic 2 My index page of forum: <?php $select_forum_cata2 = "select * from `runeweb_forum_categories` ORDER BY `position`"; $select_forum_cata1 = mysql_query($select_forum_cata2); if(mysql_num_rows($select_forum_cata1) > 0) { while ($select_forum_cata = mysql_fetch_assoc($select_forum_cata1)) { $cata_id = replace($select_forum_cata['id']); $cata_name = replace($select_forum_cata['name']); ?> <div class="brown_box_forum brown_box_stack"> <table id="forum_group<?php echo $cata_id;?>" class="forum_group"> <tr> <td class="header_groupname" colspan="2"> <div id="showhide_controls<?php echo $cata_id;?>" class="showhide_controls"> </div> <div class="groupname"><?php echo $cata_name;?></div> </td> <td id="header_threads<?php echo $cata_id;?>" class="header_threads title num">Threads</td> <td id="header_posts<?php echo $cata_id;?>" class="header_posts title num">Comments</td> <td id="header_lastpost<?php echo $cata_id;?>" class="header_lastpost title"></td> <?php $select_forum_subcata2 = "select * from `runeweb_forum_sub_categories` WHERE `categorie_id` = '$cata_id' ORDER BY `position` DESC"; $select_forum_subcata1 = mysql_query($select_forum_subcata2); if(mysql_num_rows($select_forum_subcata1) > 0) { while ($select_forum_subcata = mysql_fetch_assoc($select_forum_subcata1)) { $subcata_id = replace($select_forum_subcata['id']); $subcata_name = replace($select_forum_subcata['name']); $subcata_discription = replace($select_forum_subcata['discription']); $subcata_image = replace($select_forum_subcata['image']); $subcata_posts = replace($select_forum_subcata['posts']); $count_threadst1 = mysql_query("SELECT COUNT(id) AS threads FROM `runeweb_forum_threads` where `categorie_id` = '$subcata_id'"); $count_threads = mysql_fetch_object($count_threadst1); ?> <tr class="spacer"> <td colspan="5" style="background:#1D1506 none repeat scroll 0%;"></td></tr> <tr class="item"> <td class="icon lefttd"> <a href=""><img src="content/img/layout/icons/<?php echo $select_forum_subcata['image'];?>.gif" alt=""></a> </td> <td class="frmname"> <span class="bigtitle"><a href="forum.php?x=catagorie&categorie=<?php echo $subcata_id; ?>"><?php echo $subcata_name;?></a></span> <br /> <span class="desc"><?php echo $subcata_discription;?></a></span> </td> <td class="num"><?php echo $count_threads->threads;?></td> <td class="num"><?php echo $subcata_posts; ?></td> <td class="righttd update2"></td> </tr> <?php } } else{} ?> </tr> </table> </div> <script type="text/javascript"> showhide(!is_group_hidden(0),<?php echo $cata_id;?>); </script> <?php } } else { echo"There are no forums yet"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/ Share on other sites More sharing options...
Daniel0 Posted May 21, 2009 Share Posted May 21, 2009 Order your topics descendingly by the timestamp of its most recent reply. Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/#findComment-839152 Share on other sites More sharing options...
alex clone Posted May 21, 2009 Author Share Posted May 21, 2009 How do I do that :s? Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/#findComment-839154 Share on other sites More sharing options...
Daniel0 Posted May 21, 2009 Share Posted May 21, 2009 I don't know. I'm sure you know how your application works better than I do. Maybe if you posted your how your topics and replies (or posts or whatever you call it) tables look like I could tell you. Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/#findComment-839156 Share on other sites More sharing options...
alex clone Posted May 21, 2009 Author Share Posted May 21, 2009 Index *Removed by Alex Clone* Reply: *Removed by Alex Clone* Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/#findComment-839163 Share on other sites More sharing options...
Daniel0 Posted May 21, 2009 Share Posted May 21, 2009 I meant the tables in your database. Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/#findComment-839166 Share on other sites More sharing options...
alex clone Posted May 21, 2009 Author Share Posted May 21, 2009 Oh sorry -- phpMyAdmin SQL Dump -- version 2.11.9.4 -- http://www.phpmyadmin.net -- -- Host: localhost -- Generation Time: May 21, 2009 at 06:21 PM -- Server version: 5.0.67 -- PHP Version: 5.2.3 SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO"; -- -- Database: `zionscap_beta` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_allowed_ips` -- CREATE TABLE IF NOT EXISTS `runeweb_allowed_ips` ( `ip` varchar(255) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `runeweb_allowed_ips` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_banned_ips` -- CREATE TABLE IF NOT EXISTS `runeweb_banned_ips` ( `ip` varchar(255) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `runeweb_banned_ips` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_forbidden` -- CREATE TABLE IF NOT EXISTS `runeweb_forbidden` ( `word` varchar(255) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `runeweb_forbidden` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_forum_categories` -- CREATE TABLE IF NOT EXISTS `runeweb_forum_categories` ( `id` int(255) NOT NULL auto_increment, `name` varchar(255) default NULL, `position` int(255) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dumping data for table `runeweb_forum_categories` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_forum_comments` -- CREATE TABLE IF NOT EXISTS `runeweb_forum_comments` ( `id` int(255) NOT NULL auto_increment, `thread_id` int(255) default NULL, `owner` varchar(255) default NULL, `owner_rights` int(255) default '0', `text` text, `date` varchar(255) default NULL, `ip` varchar(255) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=14 ; -- -- Dumping data for table `runeweb_forum_comments` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_forum_sub_categories` -- CREATE TABLE IF NOT EXISTS `runeweb_forum_sub_categories` ( `id` int(255) NOT NULL auto_increment, `name` varchar(255) default NULL, `categorie_id` int(255) default NULL, `discription` varchar(255) default NULL, `image` varchar(255) default NULL, `closed` int(1) NOT NULL default '0', `posts` int(255) NOT NULL default '0', `position` int(255) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=9 ; -- -- Dumping data for table `runeweb_forum_sub_categories` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_forum_threads` -- CREATE TABLE IF NOT EXISTS `runeweb_forum_threads` ( `id` int(255) NOT NULL auto_increment, `categorie_id` int(255) default NULL, `owner` varchar(255) default NULL, `owner_rights` int(255) default '0', `title` varchar(255) default NULL, `text` text, `type` int(1) default '0', `sticky` int(1) default '0', `date` varchar(255) default NULL, `last_post` varchar(255) default NULL, `ip` varchar(255) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=12 ; -- -- Dumping data for table `runeweb_forum_threads` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_guestbook` -- CREATE TABLE IF NOT EXISTS `runeweb_guestbook` ( `id` int(255) NOT NULL auto_increment, `name` varchar(255) default NULL, `msg` text, `date` varchar(255) default NULL, `ip` varchar(255) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ; -- -- Dumping data for table `runeweb_guestbook` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_hashes` -- CREATE TABLE IF NOT EXISTS `runeweb_hashes` ( `username` varchar(255) default NULL, `hash` varchar(255) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `runeweb_hashes` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_login` -- CREATE TABLE IF NOT EXISTS `runeweb_login` ( `id` int(255) NOT NULL auto_increment, `username` varchar(255) default NULL, `password` varchar(255) default NULL, `rights` varchar(255) NOT NULL default '0', `warnings` int(11) default '0', `email` varchar(255) default NULL, `head` int(255) default NULL, `body` int(255) default NULL, `badge` int(255) default NULL, `vps` int(255) NOT NULL default '0', `online` int(1) NOT NULL default '0', `timestamp` int(15) NOT NULL default '0', `register_date` varchar(255) default NULL, `ip` varchar(255) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=13 ; -- -- Dumping data for table `runeweb_login` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_messages` -- CREATE TABLE IF NOT EXISTS `runeweb_messages` ( `id` int(255) NOT NULL auto_increment, `from` varchar(255) default NULL, `to` varchar(255) default NULL, `subject` varchar(255) default NULL, `message` text, `date` varchar(255) default NULL, PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=20 ; -- -- Dumping data for table `runeweb_messages` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_news` -- CREATE TABLE IF NOT EXISTS `runeweb_news` ( `id` int(11) NOT NULL auto_increment, `title` varchar(255) default NULL, `text` text, `index_text` text, `date` varchar(255) default NULL, `image` varchar(255) default NULL, `ip` varchar(255) default NULL, `text_url` varchar(255) default NULL, `type` int(255) NOT NULL default '0', PRIMARY KEY (`id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=26 ; -- -- Dumping data for table `runeweb_news` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_poll_answers` -- CREATE TABLE IF NOT EXISTS `runeweb_poll_answers` ( `pollid` int(255) NOT NULL default '0', `answer_id` int(255) NOT NULL auto_increment, `answer` varchar(255) default NULL, `votecount` int(255) NOT NULL default '0', PRIMARY KEY (`answer_id`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ; -- -- Dumping data for table `runeweb_poll_answers` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_poll_question` -- CREATE TABLE IF NOT EXISTS `runeweb_poll_question` ( `pollid` int(255) NOT NULL default '0', `question` varchar(255) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `runeweb_poll_question` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_poll_votes` -- CREATE TABLE IF NOT EXISTS `runeweb_poll_votes` ( `ip` varchar(255) default NULL, `pollid` int(255) default NULL ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `runeweb_poll_votes` -- -- -------------------------------------------------------- -- -- Table structure for table `runeweb_useronline` -- CREATE TABLE IF NOT EXISTS `runeweb_useronline` ( `timestamp` int(15) NOT NULL default '0', `ip` varchar(40) NOT NULL default '', `file` varchar(100) NOT NULL default '', PRIMARY KEY (`timestamp`), KEY `ip` (`ip`), KEY `file` (`file`) ) ENGINE=MyISAM DEFAULT CHARSET=latin1; -- -- Dumping data for table `runeweb_useronline` -- Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/#findComment-839173 Share on other sites More sharing options...
Daniel0 Posted May 21, 2009 Share Posted May 21, 2009 Right, so the table runeweb_forum_threads has a field called last_post. If this stores a date, order by that field. If it references a row in runeweb_forum_comments, then join the corresponding row and order by its date field. You should not store timestamps or dates as VARCHARs though, but rather as DATETIME or TIMESTAMP. Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/#findComment-839178 Share on other sites More sharing options...
alex clone Posted May 21, 2009 Author Share Posted May 21, 2009 But last post stores a date not a time so it will only act like a bump once a day Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/#findComment-839248 Share on other sites More sharing options...
Daniel0 Posted May 21, 2009 Share Posted May 21, 2009 Well, then fix it Quote Link to comment https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/#findComment-839262 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.