I've got a table with a number of records. Now right now I choose them on a single page. But I wish to create a listing. Their email list would contain multiple (about 5-10) pages.

With this, must i use physical (page1.php page2.php page3.php) or virtual pages (page.php?number=1 page.php?number=2 page.php?number3)?

I am likely to rephrase your question during my answer after which answer my question...

Quick Overview

That which you have is really a result set, which result set you want to have the ability to paginate the outcomes to ensure that you don't display all the products inside your results all at one time. You want to have the ability to display anywhere of results per page, but many likely something similar to five or ten results.


Okay, allows assume you have your result set that is loaded whenever you view index.php.

What for you to do however is just display a set fee of products from inside that result set.

I'll constitute an imaginary result set now.

$results = array( 
array( 'id' => 1, 'Apple'),
array( 'id' => 2, 'Orange'),
array( 'id' => 3, 'Banana'),
array( 'id' => 4, 'Pinapple'),
array( 'id' => 5, 'Kiwi'),
array( 'id' => 6, 'Starberries'),
array( 'id' => 7, 'Blackberries'),
array( 'id' => 8, 'Melon'),
array( 'id' => 9, 'Opal'),
array( 'id' => 10, 'Zuchini'),
array( 'id' => 11, 'Peach'),
array( 'id' => 12, 'Pear'),
array( 'id' => 13, 'Plum')

Okay, now, this is often our imaginary result set. What you look for to complete, for the first page is retrieve just the first 5 products.

Then when someone visits index.php?page=1 or index.php, they'll only get (Apple, Orange, Blueberry, Pinapple and Kiwi).

This really is known as pagination. You may either paginate through results once you have retrieved them, or paginate before you will find the results by utilizing offsets and limits in mySQL. Since you haven't stated you're using mySQL I've made the assumption you have all of your results already.

Now, for those who have a request that is available in like

GET /index.php?page=1

You would then do that:

$page = $_GET['page'];
$page ? is_numeric($page) && isset($page) ? $page : 1;
$count = 5;
$offset = $page == 1 ? 0 : (($page * $count) -1 ) - $count;
// Slice now contains your results which you can use to foreach() through    
$slice = array_slice($results, $offset,$count);


    [0] => Array
            [id] => 1
            [0] => Apple

    [1] => Array
            [id] => 2
            [0] => Orange

    [2] => Array
            [id] => 3
            [0] => Banana

    [3] => Array
            [id] => 4
            [0] => Pinapple

    [4] => Array
            [id] => 5
            [0] => Kiwi


Within this example, I've not done any actual blocking or any serious validation the $_GET page may be the correct format, but you need to get the concept.

You will find also lots of assets to create this simpler for you personally. Personally, i am a massive fan of Zend_Paginator that we use for those my pagination needs. See here Zend_Paginator

Also other assets:

Quick live example: Sample

Simply make paginator. It can be done with PHP or Javascript. In PHP you have to pass the variable of page num when user reaches another page and set it inside your SQL-query as limit. Javascript version works reduced and may use large amount of user's RAM, however it does not need page refresh - you have to fill container of records each time user changes page. If you're acquainted with AJAX you are able to mix this two techniques and obtain high profit :)