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
Share on other sites

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.