Jump to content

Recommended Posts

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 :P

 

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";
}
?> 

Link to comment
https://forums.phpfreaks.com/topic/159121-making-reply-act-like-a-bump/
Share on other sites

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`
--

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.

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.