Pagination

This post gives the information about pagination.

If website have big content in a topic,then that should be divided into small pages for easy access. you may have lot of post in a topic, paging required for easy accessing of each post.

Suppose there may be 10 post means, we can list each post in each page or list two or more post in each page. This is the decision of the publisher or designers what ever you called.

Pagination may look below

In above pagination build, Page Number, previous and Next shown. Suppose there are 100 pages like below,

100 page links also look some what okay. If there is more than 1000 page links means, pagination create havoc for readers. Its not good to list all links in a page. Better we have to limit the links like 10 per page. See the above First picture.

we are in middle of 100 page like 50 th page ,to go first and last ,We can also add First Link and Last Link for ease access.

To highlight current page or active page,we may highlight the page link a little different by changing font styles like size and background.

In above pagination build we don’t know how many pages are exists, For that we may add additional info to the build like below.

May this post help you to know what is pagination. I may add future post how to do this using php and mysql.Thank you guest for reading my post.

Create dynamic Array in PHP

Here are the instructions to create dynamic array using php.

Dynamic Array is one where the elements can be altered during run time.

This title explain you both single dimensional and multidimensional array.

First let we declare the variables,

//Single Dimensional
$single_arr=array();
//Multidimensional
$multi_arr=array();

We can able to create dynamic new array from the database tables or existing arrays.

Now we create the dynamic array from tables

TableName: test


snodeptname
1P&ARD.Premkumar
2H,P&EN.Thangamani
3AgricultureK.Shanmugam
4RD&PRP.Usha
5H&FWM.Vijayarani
6PublicR.Kalaimani
7PublicE.Dhandapani
8P&ARA.Anbarasan
9H&FWB.Kamakshi
10Sch.Edn.M.Vijayalakshmi
11AgricultureM.R.Amamath
12L&EK.Lakshmi
13RevenueS.Karikalan
14HomeS.Sellakkannu
15AgricultureG.Ramanuja Surendranath
$sql="SELECT sno,dept,name FROM test";
$query=@mysql_query($sql);
$num_query=@mysql_num_rows($query);
if($num_query>0)	{
while($fetch=mysql_fetch_assoc($query))	{
//Single Dimension Array
$single_arr[$fetch['sno']]=$fetch['name'];
//Multiple Dimension Array
$multi_arr[$fetch['dept']][$fetch['sno']]=$fetch['name'];
}
}
//echo ' < pre > ';
//print_r( $single_arr );
//print_r( $multi_arr );

Below are the output for created dynamic single dimensional array

Array
(
    [1] => D.Premkumar
    [2] => N.Thangamani
    [3] => K.Shanmugam
    [4] => P.Usha
    [5] => M.Vijayarani
    [6] => R.Kalaimani
    [7] => E.Dhandapani
    [8] => A.Anbarasan
    [9] => B.Kamakshi
    [10] => M.Vijay
    [11] => M.R.Amamath
    [12] => K.Lakshmi
    [13] => S.Karikalan
    [14] => S.Sellakkannu
    [15] => G.Ramanuja
)

Below are the output for created dynamic multidimensional array

Array
(
    [P&AR] => Array        (
            [1] => D.Premkumar
            [8] => A.Anbarasan
        )
    [H,P&E] => Array        (
            [2] => N.Thangamani
        )
    [Agriculture] => Array        (
            [3] => K.Shanmugam
            [11] => M.R.Amamath
            [15] => G.Ramanuja
        )
    [RD&PR] => Array        (
            [4] => P.Usha
        )
    [H&FW] => Array        (
            [5] => M.Vijayarani
            [9] => B.Kamakshi
        )
    [Public] => Array        (
            [6] => R.Kalaimani
            [7] => E.Dhandapani
        )
    [Sch.Edn.] => Array        (
            [10] => M.Vijay
        )
    [L&E] => Array        (
            [12] => K.Lakshmi
        )
    [Revenue] => Array        (
            [13] => S.Karikalan
        )
    [Home] => Array        (
            [14] => S.Sellakkannu
        )
)

From above we concluded that we created dynamic php array.