Jump to content

[SOLVED] Making stickies appear at the top


djfox

Recommended Posts

I am trying to get the forum to show sticky messages at the top with non-sticky messages below the stickies (I`m sure you`re familiar with nearly al forums doing this). But I can`t figure out how to get it to display that way. I have all the fields available for this in the database. But I can`t figure out how to get the php to work the way I need it to. Here`s what I`ve got:

 

<table border=0 width=100%><? //5
?>
<tr>
<td><b>Topic</b><td width=20%><b>Creator</b><td width=9%><b>Created</b><td width=8%><b>Replies</b><td width=9%><b>Update</b>
<?
  $recent = 0;
  $res = mysql_query("SELECT id,user,subject,datetime,message_text,forum_id,recent,login,repl,sticky FROM forum WHERE forum_id=$id ORDER BY recent DESC")or die( mysql_error() ); 
  while( ($fort = mysql_fetch_row($res)) && $recent < 25 ){
    if( $recent%1 == 0 ){
      
   echo "<tr><td bgcolor='312D37'><td bgcolor='312D37'><td bgcolor='312D37'><td bgcolor='312D37'><td bgcolor='312D37'><tr>";
    }
    $recent = $recent + 1;
    echo "<td><font size=2><a href='thread.php?id=$fort[0]'>$fort[2]</a></font>";
    echo "<td><font size=2><a href='trancer.php?id=$fort[1]'>$fort[7]</a></font>";
    echo "<td><font size=2>$fort[3] </font><td><font size=2>$numCom[0] </font><td><font size=2>$fort[6] </font>";   
  }
?>
</table><? //5
?> 

 

It will display the threads just fine but I need the stickies to stick on top of the list. For the sticky field, 0 is for not a sticky message, and 1 is for sticky message.

Link to comment
https://forums.phpfreaks.com/topic/60012-solved-making-stickies-appear-at-the-top/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.