PHP code example of mahmoud-abdelfadeil / php-pagination

1. Go to this page and download the library: Download mahmoud-abdelfadeil/php-pagination library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mahmoud-abdelfadeil / php-pagination example snippets




use PhpPagination\Pagination;

t",
    "db_name"=>"pagination_test",
    "db_user"=>"root",
    "db_password"=>""
];
$pagination = new Pagination($config_db,2);

$users = $pagination->table('users')->column(['*'])->get();
echo "<pre>";
var_dump($users);



use PhpPagination\Pagination;

$config_db=[
    "db_host"=>"localhost",
    "db_name"=>"pagination_test",
    "db_user"=>"root",
    "db_password"=>""
];


// param 1 (optional)=>int count items [default 20]

$count_items=10; //  optional (default 20 items in 1 page)
$pagination = new Pagination($config_db , $count_item);

$users = $pagination->table('users')->column(['*'])->get();
// tabel (table name)
// column (select column in table ) 
// column array | string 
// ex string
$users = $pagination->table('users')->column('*')->get();
$users = $pagination->table('users')->column('name , email')->get();

// ex array 
$users = $pagination->table('users')->column(['*'])->get();
$users = $pagination->table('users')->column(['name' , 'email'])->get();

<a href=" echo $pagination->prevPage() 
bash
composer