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 Link to comment https://forums.phpfreaks.com/topic/180476-multiple-page-news/ 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 Link to comment https://forums.phpfreaks.com/topic/180476-multiple-page-news/#findComment-952084 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. Link to comment https://forums.phpfreaks.com/topic/180476-multiple-page-news/#findComment-952097 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.