doddsey_65 Posted September 30, 2010 Share Posted September 30, 2010 i have some code which checks all of the posts in the database with the topic_id of $topic_id. what i want to do is like on many forums. On the topic list next to the name just show the pages like: 1-2-3-4 and when there are more than 4 or so 1-2....8-9 here is the code which gets the number of pages: $data = $db->query("SELECT * FROM ".DB_PREFIX."posts WHERE topic_id = '$topic_info->topic_id'"); $rows = mysql_num_rows($data); $page_rows = $posts_per_page; if ($rows > $page_rows) { $rowsArray = array($rows); } as you can see i have added it into an array but i dont know what to do from there. I guessed it would be something like a for statement but im not sure. Can anyone help? Quote Link to comment https://forums.phpfreaks.com/topic/214784-pagination/ Share on other sites More sharing options...
pengu Posted September 30, 2010 Share Posted September 30, 2010 There are some great tutorials on this website. Click here : http://www.phpfreaks.com/tutorial/basic-pagination Quote Link to comment https://forums.phpfreaks.com/topic/214784-pagination/#findComment-1117437 Share on other sites More sharing options...
xyph Posted September 30, 2010 Share Posted September 30, 2010 Please make an attempt before asking us It doesn't have to be code, it could be your though process... possible theoretical solutions. For example: First, I have to figure out how many pages, so I grab the total amount of entries and divide it by entries per page. I then have to check if there are more than 4 pages, and what page the user is currently on... etc Quote Link to comment https://forums.phpfreaks.com/topic/214784-pagination/#findComment-1117448 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.