phpQuestioner Posted November 25, 2007 Share Posted November 25, 2007 OK, so I have been creating this pagination script and now I want it to say: "Viewing Page 1 of 5" and I want the first number to count up for each pagination. I think I need to do this with a for loop, but need a little advice on the best way to do this. Can some one tell me what would be the best way to make my page numbers count up and down with my pagination? Here is a section of the code I am working on. <?php $display="10"; $maxresults = mysql_query("select * from $mydt"); $maxed_out = mysql_num_rows($maxresults); $total_amount_of_pgs = $maxed_out / $display; echo "Viewing $currentpg of ". round($total_amount_of_pgs) .""; ?> I am just using $currentpg as a filler value for this example; it is not defined anywhere in my code yet. Link to comment https://forums.phpfreaks.com/topic/78761-solved-how-to-display-viewing-page-1-of-5-with-pagination/ Share on other sites More sharing options...
~n[EO]n~ Posted November 25, 2007 Share Posted November 25, 2007 Like this , hope it works <?php for($i=1;$i<=$total_amount_of_pgs;$i++) { echo "Viewing $i of ". round($total_amount_of_pgs) .""; } ?> Link to comment https://forums.phpfreaks.com/topic/78761-solved-how-to-display-viewing-page-1-of-5-with-pagination/#findComment-398601 Share on other sites More sharing options...
phpQuestioner Posted November 25, 2007 Author Share Posted November 25, 2007 ~n[EO]n~ that will just give this: Viewing 1 of 5Viewing 2 of 5Viewing 3 of 5Viewing 4 of 5Viewing 5 of 5 that is the way it looks Link to comment https://forums.phpfreaks.com/topic/78761-solved-how-to-display-viewing-page-1-of-5-with-pagination/#findComment-398604 Share on other sites More sharing options...
phpQuestioner Posted November 25, 2007 Author Share Posted November 25, 2007 Thank You ~n[EO]n~ - I figured it out. Link to comment https://forums.phpfreaks.com/topic/78761-solved-how-to-display-viewing-page-1-of-5-with-pagination/#findComment-398610 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.