Xpsych0 Posted November 5, 2009 Share Posted November 5, 2009 Hello guys, First off I would like to say that I am new here and new to PHP programming however I have a PHP book in front of me and reading it as I go along. Here is what I am trying to do and I know how to do most but there are still some things that I am unfamiliar with. in my news.php page for my animal rescue website, I have over 40 news posts, they are pulled from the MySQL database and sorted out one after another and it works great but not what I want. I want to limit the news posts to 10 per page. My question is how can I accomplish this? I am assuming that I would need to do a limit on the SQL query to 10? but if I do that, I can't continue after that on a different page can I and how would I go about doing this? I have thought about looking at the codes to wordpress or another news software but most are more complicated than I need. I just need something simple. Any help would be greatly appreciated. Kris Quote Link to comment Share on other sites More sharing options...
steelmanronald06 Posted November 5, 2009 Share Posted November 5, 2009 Kris, you'd want to look into pagination. For your query you can do: mysql_query("SELECT * FROM table_name ORDER BY `id` DESC LIMIT 10"); For your pagination see: http://www.phpfreaks.com/tutorial/basic-pagination Quote Link to comment Share on other sites More sharing options...
Xpsych0 Posted November 5, 2009 Author Share Posted November 5, 2009 Thank you much steelmanronald06. I will be reading up on this more. 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.