<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
body { font:13px Tahoma, Geneva, sans-serif; }
.css-pager a { text-decoration:none; color:#666; background:#F4F4F4; border:1px solid #e0e0e0;
padding:2px 5px; margin:2px; font-weight:700; font-size:11px; }
.css-pager a:hover { text-decoration:none; color:#fff; background:#0A85CB; border:1px solid #3af;
padding:2px 5px; margin:2px; }
.current_page { background-color:#0A85CB; border:1px solid #3af; padding:2px 5px; margin:2px; color:#fff; font-weight:700; font-size:11px; }
</style>
</head>
<body>
<?php
require_once ('start_connect.inc.php');
require_once ('class_pager.php');
/**
* string query
*/
$command = 'SELECT * FROM test_table';
/**
* get object result from database
*/
$result = mysql_query($command);
/*
* Configuration pager
*/
$config['url_page'] = 'index.php?page=';
$config['all_recs'] = mysql_num_rows($result); // all row of data
$config['scr_page'] = 10; // scroll page
$config['per_page'] = 5; // per pager
$config['cur_page'] = ($_GET['page']) ? $_GET['page'] : 1; // current page
$config['act_page'] = 'class="current_page"'; // class css current page
$config['css_page'] = 'class="css-pager"'; // clss css area split page
$config['first'] = '« First'; // first page
$config['previous'] = '‹ Prev'; // previous page
$config['next'] = 'Next ›'; // next page
$config['last'] = 'Last »'; // last page
/**
* create pager instance
*/
$pager = new Pager($config);
/**
* display pager up data
*/
try {
$pager->createPager();
}
catch(Exception $e) { echo $e->getMessage(); }
/**
* display data
*/
$result = mysql_query($command." ORDER BY id ASC LIMIT ".$pager->limitStart().", ".$config['per_page']) or die (mysql_error());
echo ' <span>ID.</span>';
echo ' <span>Name</span> ';
echo ' <span>Surname</span> ';
echo ' Email';
echo '<br />';
if($result) {
while($rs = mysql_fetch_assoc($result)) {
echo ' <span>'.$rs['id'].'</span> ';
echo '<span>'.$rs['name'].'</span> ';
echo '<span>'.$rs['surname'].'</span> ';
echo '<a href="mailto:ranarong@live.com">'.$rs['email'].'</a>';
echo '<br />';
}
}
/**
* display pager down data
*/
try {
$pager->createPager();
}
catch(Exception $e) { echo $e->getMessage(); }
?>
</body>
</html>
|