Jump to content

[Theory] Making a conditioned blog


abyssal

Recommended Posts

Hi guys. I wanted to make a blog but I'm really really stuck with an issue. I want to make a blog script (much like wordpress).

 

My SQL table has the columns: post_title (char), post_content (char) and post_comments_number (integer - gets the number of comments for each blog post).

 

Now I want to display the posts on two pages: posts with high number of comments (>30) and posts with low number of comments (<=30). I want to display the posts just like they are displayed on wordpress but the problem is I don't know how to do that, mostly when it comes to display the posts on multiple pages, 10 posts on each page.

 

Shortly: I want to display 10 posts with 30+ comments on the first page, the next 10 posts on the 2nd page and so on. How do I do that ? I think my logic fails because I don't know how to determine what was the latest post on the first page, so I can grab the next following posts on the following page.

 

Any help with that ?

Link to comment
Share on other sites

Breaking up content over pages is called "pagination", see here: http://www.phpfreaks.com/tutorial/basic-pagination

 

Do you really need a column to count the comments? That means that for every added or deleted comment you have to have an additional write. You could use a subquery to count how many comments for each post instead.

 

 

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.