<?php
class php_run{
var $_Account,$_Page,$_Group;
function php_run(){
include("lib/conn.php"); //include database link file
}
function getAddList(){
include("page.class.php");
$page_count =30; //Page Count
$table_name ="table_address"; //Table Name
if(isset($_POST["key"]) && $_POST["key"]!="")
{
$key =mysql_escape_string($_POST["key"]);
$condition =" where address_owner='".$this->_Account."' and address_type='".$this->_Group."' and (address_name like '%".$key."%' or address_nickname like '%".$key."%' or address_phone like '%".$key."%' or address_handset like '%".$key."%')";
}
else
$condition =" where address_owner='".$this->_Account."' and address_type='".$this->_Group."'";
$orders ="order by address_name,address_nickname";
$fields =" address_id,address_name,address_nickname,address_phone,address_handset ";
$link ="?time=".time();
$newpage =new SplitPage($page_count,$table_name,$fields,$condition,$orders,$link); //Initialitation
$this->_Page=$newpage->_page;
if($newpage->_totalrecord>0)
{
$result =$newpage->getQueryResult(); //Get Query Result
$i=0;
while($row=mysql_fetch_array($result))
{
echo "<tr><td> ".$row["address_name"]."</td>\n";
echo "<td>".$row["address_phone"]."</td>\n";
echo "<td>".$row["address_handset"]."</td>\n";
$i++;
}
echo "<tr><td style='border:0px' colspan='9' align='right' width=100%>";
$newpage->createSplitPage(); //Write Split Result JS Code
echo "</td></tr>";
mysql_free_result($result);
}
else
{
echo "<tr><td style='border:0px' colspan='9' align='center'><br><br><br><center><font style='font-size:9pt' color='red'>Not Record!</font></center><br><br><br></td></tr>";
}
}
}
$PageMain =new php_run();
?>
<html>
<head>
<title>LIST</title>
</head>
<body>
<table width="500" border="1" cellspacing="0" cellpadding="5" style="FONT-SIZE: 9pt; border-style:outset;border-collapse: collapse;">
<tr class="header-div">
<td align="center" width="120">Name</td>
<td align="center" width="120">Phone</td>
<td align="center" width="110">Handset</td>
</tr>
<?php $PageMain->getAddList()?>
</table>
</body>
</html>
|