<?php
/***************************************************************************************/
/** **/
/** Copyright (c)'2010 by Igor Homyn **/
/** **/
/** hide@address.com **/
/** **/
/** http://www.phpclasses.org/package/6689-PHP-Dynamic-pagination-of-MySQL-table.html **/
/** **/
/***************************************************************************************/
session_start();
@mysql_pconnect('localhost', 'root', '') or die("Could not connect to database!");
mysql_select_db('ajaxpagination') or die("Could not select database");
require("AJAXpagination.php");
if (isset($_GET['option']) && ($_GET['option'] == 'getdata')) {
// usleep(2000000); // uncomment this line to ensure the spinner effect during AJAX request
print JSONdata();
exit;
}
$mplist = new AJAXpagination('select id, name name, bio, concat("images/", file) img
from famous
order by id', 'mplist', 2);
print '<html><head><title>The AJAXpagination by Igor Homyn (c) 2010 demo</title>
<script src="includes/mootools.js" type="text/javascript"></script>
<script src="includes/mootools-more.js" type="text/javascript"></script>
'."\n";
print '
<style type="text/css">
.spinner{
background:#ccc url(images/spinner.gif) no-repeat center;
opacity:0.5; -moz-opacity:0.5; -khtml-opacity:0.5; filter:progid:DXImageTransform.Microsoft.Alpha(opacity=50);
}
</style>
</head>
<body>
';
print AJAX_PG_FUNC;
print '
<table width=600px border=0 align=center>
<tr><td colspan=2 align=center><h2>Famous Ukrainians</h2></td></tr>
<tr><td colspan=2 align=center><span id="mplistnav.top">'.$mplist->page_navigation.'</span></td></tr>
<tbody id="mplist">'."\n";
// {cycle values="#ffffdd,#eeffff"}
reset($mplist->rows);
while (list($key, $val) = each($mplist->rows)) {
print '
<tr bgcolor="">
<td valign=top width=205><img src="'.$val['img'].'" width=205 id="mplist.img"></td>
<td valign=top><b><span id="mplist.name">'.$val['name'].'</span></b><br>
<span id="mplist.bio">'.$val['bio'].'</span> </td>
</tr>
'."\n";
}
print '
</tbody>
<tr><td colspan=5 align=center><span id="mplistnav.bot">'.$mplist->page_navigation.'</span></td></tr>
</table>
</body>
</html>
';
?>