c-o-d-e Posted December 6, 2009 Share Posted December 6, 2009 I have pagination for all my news. Which can be viewed here. http://developers-community.com/allnews.php (Page isn't complete yet so still some things relating to job vacanies) On the page is a random "0" at the top, I imagine this is the page number? I don't want that there. Also, how do I get it to display all the pages underneath the results. So it should look like this in total. You can view all our updates ever been released for the whole website. Unfortunately, there are 6 lost updates that nobody will be able to see. Mystery huh? Admin features & Recent News area 06/12/2009 08:37:56 We have changed the Recent News section. Instead of editting files, theres now an Admin section for it! 1, 2, 3 .. 5 Here is my code for it. <h1>News and Updates</h1> <p>You can view all our updates ever been released for the whole website. Unfortunately, there are 6 lost updates that nobody will be able to see. Mystery huh?</p> </div> <p> <?php include 'config.php'; $query = mysql_query("SELECT * FROM News ORDER BY Posted DESC") or trigger_error('Query failed: '. mysql_error()); $totalrows = mysql_num_rows($query); $numberofpages = $totalrows / '10'; if(isset($_GET['page'])) { $currentpage = $_GET['page'] * '10'; } else { $currentpage = 0 * '10'; }; $query = mysql_query("SELECT * FROM News ORDER BY Posted DESC LIMIT $currentpage, 10 ") or trigger_error('Query failed: '. mysql_error()); $pages=0; while($pages < $numberofpages) { if($pages == mysql_real_escape_string($_GET['page'])){echo $pages.' '; $pages ++; } else { echo '<a href="allnews.php?&page='.$pages.'">'.$pages.'</a> '; $pages ++; }; while($row = mysql_fetch_array($query)) { echo '<h4 style="margin:0px; font-size:14px;">'. $row['Artname'] .'</h4>'; echo '<h4 style="margin:0px; font-size:13px;">'. $row['Posted'] .'</h4>'; echo '<p style="margin:0px;">'. $row['Article'] .'</p><br /><br />'; }; } ?> Any help? Thanks. Link to comment https://forums.phpfreaks.com/topic/184171-moving-1-2-3-4-etc-in-pagination/ Share on other sites More sharing options...
MatthewJ Posted December 6, 2009 Share Posted December 6, 2009 As you may have guessed... multiplication by 0 = 0 $currentpage = 0 * '10'; Link to comment https://forums.phpfreaks.com/topic/184171-moving-1-2-3-4-etc-in-pagination/#findComment-972338 Share on other sites More sharing options...
c-o-d-e Posted December 6, 2009 Author Share Posted December 6, 2009 Thanks for that point out, but how do I make it so that the "0" isn't displayed on the page, and then move the 1, 2, 3, 4 etc.. to under the results. Like.. a topic on here, at the bottom displays pages: [1] etc. Link to comment https://forums.phpfreaks.com/topic/184171-moving-1-2-3-4-etc-in-pagination/#findComment-972340 Share on other sites More sharing options...
phant0m Posted December 6, 2009 Share Posted December 6, 2009 echo $pages.' '; that's what causes the zero to appear. Link to comment https://forums.phpfreaks.com/topic/184171-moving-1-2-3-4-etc-in-pagination/#findComment-972341 Share on other sites More sharing options...
c-o-d-e Posted December 6, 2009 Author Share Posted December 6, 2009 Ok, thanks. What i've done with that, is removed it. What about the page numbers? I'm guessing that would be this bit.. echo '<a href="allnews.php?&page='.$pages.'">'.$pages.'</a> '; $pages ++; Would I turn that into an variable, and then echo the variable later on down where I want it to be? Link to comment https://forums.phpfreaks.com/topic/184171-moving-1-2-3-4-etc-in-pagination/#findComment-972344 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.