error_reporting(E_ALL);
/**
* Cofiguration: patients per page
*/
define('PATIENTS_PER_PAGE', 3);
/**
* Get required files
*/
require_once 'Components/DB/dibi/dibi.php';
require_once 'Components/MountainPet/news_framework.php';
require_once 'paging.class.php';
/**
* Create and connect DiBi adapter
*/
dibi::connect(array(
'driver' => 'mysql',
'host' => '217.11.237.244',
'username' => 'gardenik',
'password' => 'FUNtr4d3',
'database' => 'news_nepal',
), 0);
/**
* Create manager instance & get total counts
*/
$manager = new MessageManager();
$total = $manager->Count('patients');
/**
* Create paging
*/
if(isset($_GET['page']))
$page = intval($_GET['page']);
else
$page = 1;
// Check we have correct page (means more than 0)
if($page < 1)
$page = 1;
// Create page itself
$paging = new Paging(new PagingPage($page, ($page - 1) * PATIENTS_PER_PAGE), PATIENTS_PER_PAGE, $total);
// Check if we have not overloaded the page number. If so, set better current page
if($paging->currentPage->start > $total) {
$currentIdp = $paging->getIdpByIde($total - 1);
$paging->currentPage = new PagingPage($currentIdp, ($currentIdp - 1) * PATIENTS_PER_PAGE);
}
/**
* Make the list of the patients
*/
$patients = $manager->Get('patients', 'ORDER BY id DESC LIMIT ' . $paging->currentPage->start . ', ' . PATIENTS_PER_PAGE);
/**
* Loop thru
*/
foreach($patients as $patient) { ?>
} //...foreach ?>
name: = $patient['name'] ?> = $patient['surname'] ?>, age: = $patient['age'] ?> years
= $patient['commenten'] ?>
total spent on this treatment: USD = $patient['cost'] ?> (= $patient['covered'] ?>)






