<?php
include_once('IsLogined.php');
include_once("../config/templateConfig.inc.php");
include_once("../config/databaseConfig.inc.php");
$templateMain = new SmartTemplate('Admin_DIYorder.html');

/*
$tn 总记录数
*/
$sqltn="select count(*) from DIYorder";
$tn =$db->GetOne($sqltn);
/*
分页设置
计算页数
*/
$page_size = 15;
$tp = ceil($tn / $page_size);
$cp =(int)$_GET["p"];
empty($cp)==true ? $cp=1:$cp=(int)$_GET["p"];
if ($cp < 1) $cp   = 1 ;
if ($cp > $tp) $cp = $tp; 
/*
取记录
输出主体部分
*/
$sqlrs="select ID,Dname,Dtel,Daddr,Dinfo,Dorder,Dtime from DIYorder order by ID ASC";
$rs = $db->SelectLimit($sqlrs,$page_size,($cp-1) * $page_size);
$rs = $rs->GetRows();
$templateMain->assign('DIY',$rs);
$templateMain->assign('CP',$cp);
$templateMain->assign('Pr',$cp-1);
$templateMain->assign('Ne',$cp+1);
$templateMain->assign('TP',$tp);
$templateMain->assign('TN',$tn);
$templateMain->output();
?>