Jump to content

Recommended Posts

Hey,

My friend had sent my a forum software which I enjoy using alot [Hardly anyone has it - Only me, him and a few other people...]

 

Anyways..

When people create new threads older topics go above the newer topics which it shouldnt be like that :s

Eg it goes:

Thread 1

Thread 2

Thread 3

Etc..

 

When it should be:

Thread 3

Thread 2

Thread 1

Etc..

 

Do you get what I mean? The new topics shoul;d go first

 

How do I do that?

 

Plz and thx.

Link to comment
https://forums.phpfreaks.com/topic/159108-solved-help-dno-wut-title-2-put-s/
Share on other sites

No within the code base of your forum. That's not the whole SQL though, it's just a part of the query, also note it'll be near the end. If you know PHP/MySQL, try searching through the files for "ASC" (turn off case matching) and trying to find the relevant query. As I said before though can't help you as we can't see the code. If you still have troubles probably best contacting the developer behind it, or someone else who uses the forum, and asking for help off them.

Index.php: [i've changed Order by 'Position' to Order by 'DESC' but It doesnt work :(

 

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

Replace:

 

$select_forum_subcata2 = "select * from `runeweb_forum_sub_categories` WHERE `categorie_id` = '$cata_id' ORDER BY `position`";

 

With:

 

$select_forum_subcata2 = "select * from `runeweb_forum_sub_categories` WHERE `categorie_id` = '$cata_id' ORDER BY `position` DESC";

If you don't already have one, create a "last_activity" kind of field within the "runeweb_forum_sub_categories" table with a DATETIME data type. You can then order by that instead... I imagine though you're going to have to do some extra work in order to update this field every time someone makes a post.

 

Make sure there's not one there already...

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.