alejandro52 Posted August 11, 2007 Share Posted August 11, 2007 i have created a database with some data in it and i want my page to read page and display the first 20 results and on the bottom to add numbers like [1] [2] [3] so the user can go to the next results.I figured that i can display the first 20 results by adding a counter on the while loop $num_rows = mysql_num_rows($result); $k=0; while (($k<=20)&&($row = mysql_fetch_row($result))){ $k+=1; $i+=1; but i don't know how to display the numbers on the bottom.Here is my try <?php for($j=1;$j<=($num_rows/20);$j+=1){ echo "[".$j."]"; } ?> Link to comment https://forums.phpfreaks.com/topic/64377-solved-how-to-show-20-results-per-page/ Share on other sites More sharing options...
alejandro52 Posted August 11, 2007 Author Share Posted August 11, 2007 http://www.phpfreaks.com/forums/index.php/topic,143838.0.html http://www.phpfreaks.com/forums/index.php/topic,120064.0.html Ok found it.I should had looked earlier. :-\ Link to comment https://forums.phpfreaks.com/topic/64377-solved-how-to-show-20-results-per-page/#findComment-321000 Share on other sites More sharing options...
MadTechie Posted August 11, 2007 Share Posted August 11, 2007 <?php $total = 200; $PerPage = 20; for($n=1;$n<=($total / $PerPage);$n++) { echo "[{$n}]"; } ?> Link to comment https://forums.phpfreaks.com/topic/64377-solved-how-to-show-20-results-per-page/#findComment-321001 Share on other sites More sharing options...
alejandro52 Posted August 11, 2007 Author Share Posted August 11, 2007 http://www.phpfreaks.com/forums/index.php/topic,143838.0.html http://www.phpfreaks.com/forums/index.php/topic,120064.0.html Also http://www.phpfreaks.com/tutorials/73/0.php Ok found it.I should had looked earlier. :-\ Link to comment https://forums.phpfreaks.com/topic/64377-solved-how-to-show-20-results-per-page/#findComment-321002 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.