zhTonic Posted November 12, 2008 Share Posted November 12, 2008 Hey guys, What i'm trying to do is when i select all of the threads to be displayed, i have some flagged as stickies and i want them to always be at the top no matter what. I'm not sure if this is achieved via mysql or php, any help would be appreciated. Thanks. Quote Link to comment Share on other sites More sharing options...
GingerRobot Posted November 12, 2008 Share Posted November 12, 2008 How are they being marked as stickied threads? Generally, the approach is to have some field in your topics table called sticky (or, perhaps, status if you wish to have different levels of thread importance). You would then set the field to 1 for any stickied threads and 0 for those which are not. When you select the topics, you order by sticky (or status) first and date second. Quote Link to comment Share on other sites More sharing options...
zhTonic Posted November 12, 2008 Author Share Posted November 12, 2008 How are they being marked as stickied threads? Generally, the approach is to have some field in your topics table called sticky (or, perhaps, status if you wish to have different levels of thread importance). You would then set the field to 1 for any stickied threads and 0 for those which are not. When you select the topics, you order by sticky (or status) first and date second. That's how i have it in the database right now, there is a sticky field in the row... Also thanks for reminding me about ORDER BY i totally forgot about it. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.