query.php:
--------------##################################################--
---###################################################
query.html
--------------##################################################--
<link rel="stylesheet" type="text/css" href="./resource/page.css" />
<?php
include_once ('global.php');
$pageSize=20;
if(!$_GET[page]){
$firstcount=0;
}else{
$firstcount=($page-1)*$pageSize;
}
echo '<br>';
echo '<br>';
if ($_GET[submit]||$page) {
$sql = "select dep,name,ms_tel,gs_tel,m_tel,g_tel from sztelecom_tel where (dep like '%" . $_GET[value] . "%' or name like '%" . $_GET[value] . "%' or g_tel like '%" . $_GET[value] . "%' or m_tel like '%" . $_GET[value] . "%') order by dep limit $firstcount,$pageSize ";
$query = $mysql->getall($sql);
$total=mysql_num_rows(mysql_query("SELECT * FROM `sztelecom_tel` where (dep like '%" . $_GET[value] . "%' or name like '%" . $_GET[value] . "%' or g_tel like '%" . $_GET[value] . "%' or m_tel like '%" . $_GET[value] . "%')"));
$restr= '查询参数:'.$_POST[value]."<br>".'查询结果个数:'.$total."<br>";
}
pageft($total,$pageSize,1,1,1,9,20,1);
$smarty->clear_all_cache();
$smarty->assign("value",$_GET[value]);
$smarty->assign("list", $query);
$smarty->assign("restr", $restr);
$smarty->assign("webTitle", $webTitle);
$smarty->display("query_tel.html");
?>
<div class="yahoo"><?php echo $pagenav;?></div>
---###################################################
query.html
<html>
<head>
<meta http-equiv="content-type" content="text/html;charset=GBK">
<link rel="stylesheet" type="text/css" href="./resource/system.css" />
<title>{$webTitle}</title>
</head>
<body>
<center>
<form action="" method="get">
请输入模糊查询值:<input type="text" name="value" value={$value}>
<input class="btn" type="submit" name="submit" value=" 查 询 "/>
</form>
<br>
<font color="red">
{$restr}
</font>
<br><br>
<table border="0" cellpadding="5" cellspacing="1" bgcolor="#add3ef" width="80%">
<tr bgcolor="#eff3ff">
<td>部门</td><td>姓名</td><td>固定电话</td><td>固话短号</td><td>CDMA手机</td><td>手机短号</td>
</tr>
{section name=sn loop=$list}
<tr bgColor="#ffffff">
<td>{$list[sn].dep}</td><td>{$list[sn].name}</td><td>{$list[sn].g_tel}</td><td>{$list[sn].gs_tel}</td><td>{$list[sn].m_tel}</td><td>{$list[sn].ms_tel}</td>
</tr>
{/section}
</table>
</center>
</body>
</html>