รายละเอียดของการตอบ ::
<?php
include ('connect.php');
$count=0;
//echo $sql;
mysql_query("SET NAMES TIS620");
$strSQL = "SELECT * FROM lisadmin group by id_admin ";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
$Num_Rows = mysql_num_rows($objQuery);
$Per_Page =5; // Per Page
$Page = $_GET['Page'];
if(!$_GET['Page'])
{
$Page=1;
}
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$Page_Start = (($Per_Page*$Page)-$Per_Page);
if($Num_Rows<=$Per_Page)
{
$Num_Pages =1;
}
else if(($Num_Rows % $Per_Page)==0)
{
$Num_Pages =($Num_Rows/$Per_Page) ;
}
else
{
$Num_Pages =($Num_Rows/$Per_Page)+1;
$Num_Pages = (int)$Num_Pages;
}
$strSQL .="LIMIT $Page_Start , $Per_Page";
$objQuery = mysql_query($strSQL);
?>
<table width="555" border="0" align="center" cellPadding="0" cellSpacing="0" class="tahoma">
<tr>
<td align="center" class="tahoma" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid; border-top:
#000000 1px solid; border-right:#000000 1px solid"><strong>ลำดับที่</strong></td>
<td align="center" class="tahoma" style="BORDER-BOTTOM: #000000 1px solid; border-top:
#000000 1px solid; border-right:#000000 1px solid"><strong>ชื่อ Admin</strong></td>
<td align="center" class="tahoma" style="BORDER-BOTTOM: #000000 1px solid; border-top:
#000000 1px solid; border-right:#000000 1px solid"><strong>จำนวนที่อัพโหลด</strong></td>
<td align="center" class="tahoma" style="BORDER-BOTTOM: #000000 1px solid; border-top:
#000000 1px solid; border-right:#000000 1px solid"><strong>หน่วยงานที่สังกัด</strong></td>
</tr>
<?
while($r = mysql_fetch_array($objQuery))
{
$count++;
$id_admin=$r['id_admin'];
$ad_name=$r['ad_name'];
$ad_status=$r['ad_status'];
//$total=$r[total];
$ad_agen=$r['ad_agen'];
//$f1=$r['f1'];
?>
<?
$sqlsum="select count(id_lis) as total from crulis1,lisadmin where crulis1.id_admin=lisadmin.id_admin and lisadmin.id_admin='$r[id_admin]' order by total ";
$sumresult=mysql_query($sqlsum);
$rssum=mysql_fetch_array($sumresult);
$total=$rssum[total];
?>
<tr onmouseover="this.bgColor='#99CCFF'" onmouseout="this.bgColor='#FFFFFF'" >
<td width="57" align="center" class="tahoma" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid" border="0" cellSpacing="0" cellPadding="0"><?=$count?></td>
<td width="187" align='center' class="tahoma" style="BORDER-BOTTOM: #000000 1px solid; BORDER-LEFT: #000000 1px solid;BORDER-RIGHT: #000000 1px solid" border="0" cellSpacing="0" cellPadding="0"><?=$ad_name?></td>
<td width="104" align="center" class="tahoma" style="BORDER-BOTTOM: #000000 1px solid;BORDER-RIGHT: #000000 1px solid" border="0" cellSpacing="0" cellPadding="0"><?=$total?> </td>
<td width="252" align="center" class="tahoma" style="BORDER-BOTTOM: #000000 1px solid;BORDER-RIGHT: #000000 1px solid" border="0" cellSpacing="0" cellPadding="0"><?=$ad_agen?></td>
<?
}
?>