abyssal Posted April 5, 2012 Share Posted April 5, 2012 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/260396-theory-making-a-conditioned-blog/ Share on other sites More sharing options...
scootstah Posted April 6, 2012 Share Posted April 6, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/260396-theory-making-a-conditioned-blog/#findComment-1334952 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.