Jump to content

SQL Help Please


Neroo

Recommended Posts

I'm currently creating my own Forum on my website and I need some help with my SQL query please.

 

 

$gettopic=$db->query("SELECT * FROM forum_topics WHERE forum='{$id}' ORDER BY pinned ASC, time DESC LIMIT 20");

 

 

When topics are pinned, their column goes to 1, so when there are pinned topics in that forum, they need to be at the top of the list while all other times need to be ordered by their time.

Link to comment
Share on other sites

if($t['pinned'] == 1) {

$p=" <img src='/images/forums/pinned.png' title='Pinned' height=12 width=12>"; }

else { $p="";

}

 

 

 

Eurgh, nevermind. I forgot to add the else, so they were all showing the pinned icon *facepalm* all fixed :)

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.