Login   Register  
PHP Classes
elePHPant
Icontem

File: pagination.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of John Doe  >  Simple pagination MySQL  >  pagination.php  >  Download  
File: pagination.php
Role: Example script
Content type: text/plain
Description: How to use the class
Class: Simple pagination MySQL
Show MySQL query results split in multiple pages
Author: By
Last change:
Date: 6 years ago
Size: 2,788 bytes
 

Contents

Class file image Download
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>

<head>
<style type="text/css">

body {margin:0px ; padding:0px ; background-color: #ccc; font-family: "Century Gothic","Trebuchet MS","Arial Narrow",Arial,sans-serif ; font-size: 12px;}
.main { width:100% ; margin:0 auto 0 auto ; background: #eee; text-align: center;}
a:link{color:black ;text-decoration: none; font-size: 14px;}
a:hover{color:gray ; font-size: 14px;}
a:active{color:gray ; font-size: 14px;}
a:visited{color:black ; text-decoration: none; font-size: 14px;}
 
table  {text-align: center; border-collapse:collapse; margin:20px auto 0 auto  }
td {padding:5px ;border-bottom: 1px solid gray; }
tr {border-bottom: 1px solid gray;}
.nav {margin-top :20px ;margin-bottom:20px }
.nav td {background:white ; border:1px solid gray ; padding : 2px 10px 2px 10px ; }

</style>

    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
    <meta name="author" content="" />

    <title>Pageination </title>
</head>

<body>



<?php

include 'pageination.class.php';


$db_info = array( 'hostname' => 'localhost',          // Mysql server hostname 90% this will be localhost 
                  
'username' => 'user',               // Your mysql username
                  
'password' =>'pass',              // Your mysql password
                  
'database' => 'db',              // Mysql database name this is not same with the tablename !
                   
'table' => 'table'                  // Mysql tablename goes here
                
);
                
$dis_info = array('results_per_page' => '10',         // How much results you want to be displayed on one page 
                  
'numbers' => '8'                    // How much you want digits pageination bar should have 
                  
);                                  //    Back 1 2 3 4 Next  >> this is 4 digits
                                                        //    Back 1 2 3 4 5 Next  >> this is 5 digits                
                  
$col_info = array('colnameX' => 'all');                  // Which columns you want to be displayed if youre not sure
                                                      // leave it like this , if you want specific columns edit 
                                                      // the one bellow 
                                                      //$col_info = array (   '0' => 'col1',
                                                      //                       '1' => 'col2',
                                                      //                       '2' => 'col3',
                                                      //                       '3' => 'col4',
                                                      //                   );


$MAKE = new Pageination;
$MAKE->connect_info $db_info;
$MAKE->display_data $dis_info;
$MAKE->selected_columns $col_info;


$MAKE->GetMysqlData("SELECT * FROM  $db_info[table] ");   // You can put your mysql query here but instead the table name
                                                          // use  $db_info[table]  
                                                        
?>


</body>
</html>