Jump to content

Keep 1 record at top in while loop


doddsey_65

Recommended Posts

I am creating a sticky topic feature for my forum and dont know how to keep

all topics marked sticky at the top of the list generated by the while loop. Any one have any ideas?

They are ordered by the post date column.

 

Here is the query:

 

$posts_info_query = $db->query("SELECT 
					p.post_id,
					p.topic_id,
					p.forum_id,
					p.post_poster,
					p.post_subject,
					p.post_content,
					p.post_time,
					p.post_edit_by,
					p.post_edit_date,
					p.post_edit_num,
					p.post_approved,
					p.post_quoting,
					m.user_id,
					m.user_username,
					m.user_group,
					m.user_regdate,
					m.user_birthday,
					m.user_online,
					m.user_sex,
					m.user_location,
					m.user_show_sex,
					m.user_show_location,
					m.user_show_status,
					m.user_avatar,
					m.user_sig,
					m.user_posts

					FROM ".DB_PREFIX."posts as p

					LEFT JOIN ".DB_PREFIX."members as m
					ON p.post_poster = m.user_username

					WHERE p.topic_id = '$topic_id' 

					ORDER BY p.post_time ASC

					LIMIT $start, $limit")

					or trigger_error("SQL", E_USER_ERROR);

 

Thanks

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.