|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
|
|||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Page-style data display system
, I have a database table to which contains posts from people.
I want to retrieve these and post them in a linear format (as I currently have), but! I want to have pages, each page has 50 rows from the database at a time. If I have 102 results, I want it to be separated into three pages. Page: 1, 2, 3 The page link I want to be displayed in the URL as a variable: page=1 (example). Each row is ordered with a primary key page=1 will return the first 50 results (1 - 50) page=2 will return the next 50 results (51 - 100) page=3 will return the next two results (101 - 102) I want a system that will automatically do this. I want the page numbers to increase along with how many results are in the database. At the moment there are only three, but in time it will grow. So essentially it should start off at Page: 1, then increase as I hit the 50th entry. Is there anyone who can help me with this? If you need more detail, please email me and I'll try to explain more in-depth! Many thanks! I hope you can help! Thanks for your time all! ~Dan |
|
#2
|
|||
|
|||
|
Page-style data display system
Dan
You may want to try the Pear Pager package: -- Thanks, John Ellingsworth Project Leader, Virtual Curriculum Academic Programs School of Medicine University of Pennsylvania (215) 573-4451 Virtual Curriculum AIM: vc2000support To contact the Virtual Curriculum team: cu2000 (AT) mail (DOT) med.upenn.edu -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
#3
|
|||
|
|||
|
Page-style data display system
Dan
You may want to try the Pear Pager package: [sorry for the missing link] -- Thanks, John -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
#4
|
|||
|
|||
|
Page-style data display system
Daniel Anderson wrote:
, I have a database table to which contains posts from people. I want to retrieve these and post them in a linear format (as I currently have), but! I want to have pages, each page has 50 rows from the database at a time. If I have 102 results, I want it to be separated into three pages. Page: 1, 2, 3 The page link I want to be displayed in the URL as a variable: page=1 (example). Each row is ordered with a primary key page=1 will return the first 50 results (1 - 50) page=2 will return the next 50 results (51 - 100) page=3 will return the next two results (101 - 102) I want a system that will automatically do this. I want the page numbers to increase along with how many results are in the database. At the moment there are only three, but in time it will grow. So essentially it should start off at Page: 1, then increase as I hit the 50th entry. Is there anyone who can help me with this? If you need more detail, please email me and I'll try to explain more in-depth! Many thanks! I hope you can help! Thanks for your time all! ~Dan Try something to the likes of this: <?php $pageid = intval($_GET['page']); $startlimit = ($pageid - 1) * 50; $endlimit = $pageid * 50; mysql_query("SELECT * FRM yourtable LIMIT $startlimit , $endlimit"); ?> -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
|
#5
|
|||
|
|||
|
Page-style data display system
just try this:
It's very easy to use. 1/20/06, Wayne Khan <kzhiwei (AT) singnet (DOT) com.sgwrote: Hi Daniel, You won't need something so complicated as PEAR or what. > > Try out this tutorial. Its how I got my damned pagination code working. :) > Message From: El Bekko [mailto:elbekko (AT) gmail (DOT) com] Sent: Sunday, January 15, 2006 5:58 AM To: php-windows (AT) lists (DOT) php.net Subject: [PHP-WIN] Re: Page-style data display system > Daniel Anderson wrote: , I have a database table to which contains posts from people. I want to retrieve these and post them in a linear format (as I currently have), but! I want to have pages, each page has 50 rows from the database at a time. > If I have 102 results, I want it to be separated into three pages. > Page: 1, 2, 3 > The page link I want to be displayed in the URL as a variable: page=1 (example). > Each row is ordered with a primary key > page=1 will return the first 50 results (1 - 50) page=2 will return the next 50 results (51 - 100) page=3 will return the next two results (101 - 102) > I want a system that will automatically do this. I want the page numbers to increase along with how many results are in the database. At the moment there are only three, but in time it will grow. So essentially it should start off at Page: 1, then increase as I hit the 50th entry. > Is there anyone who can help me with this? If you need more detail, please email me and I'll try to explain more in-depth! > Many thanks! I hope you can help! > Thanks for your time all! > ~Dan > Try something to the likes of this: > <?php > $pageid = intval($_GET['page']); $startlimit = ($pageid - 1) * 50; $endlimit = $pageid * 50; > mysql_query("SELECT * FRM yourtable LIMIT $startlimit , $endlimit"); > ?> > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php |
![]() |
| Viewing: Web Development Archives > Mailing Lists > PHP - Windows > Page-style data display system |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|