|
|
|
ช่วยด้วย !! ต้องการทำโค๊ดแบ่งหน้า คับ ลองทำแล้ว แบ่งหน้าได้ แต่ไม่แสดงหน้า 2 อะคับ |
|
|
|
|
|
|
|
แบ่งหน้าได้แล้ว อะคับ แต่ พอกดหน้า 2 ไม่มีข้อมูลแสดง เลย อะคับ
Code (PHP)
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>สำหรับผู้ดูแลระบบ</title>
</head>
<body>
<?
@session_start();
include "../include/ConnectionDb.php";
include "../include/function.php";
include "checksession.php";
$page=$_GET[page];
if ($page=="") {
$page=1;
}
$each=10;
$m=$_REQUEST['month'];
$y=$_REQUEST['year'];
$key=$m . "/" . $y;
if ($_REQUEST['search']=="1") {
$sql_cat = "SELECT * FROM tbaddadsl WHERE date ORDER BY date ";
$result_cat = mysql_query($sql_cat);
$totals = mysql_num_rows($result_cat);
$totalpages=ceil($totals/$each);
$goto = ($page-1)*$each;
$sql_cat = "SELECT * FROM tbaddadsl WHERE date ORDER BY date DESC limit $goto,$each;";
$result_cat = mysql_query($sql_cat);
} elseif ($_REQUEST['search']=="2") {
$sql_cat = "SELECT * FROM tbaddadsl WHERE date AND substr(date, -7, 7)='$key' ORDER BY date DESC";
$result_cat = mysql_query($sql_cat);
$totals = mysql_num_rows($result_cat);
} elseif ($_REQUEST['search']=="3") {
$sql_cat = "SELECT * FROM tbaddadsl WHERE date AND substr(date, -4, 4)='$y' ORDER BY date DESC";
$result_cat = mysql_query($sql_cat);
$totals = mysql_num_rows($result_cat);
} elseif ($_REQUEST['search']=="4") {
$sql_cat = "SELECT * FROM tbaddadsl WHERE date ORDER BY date DESc";
$result_cat = mysql_query($sql_cat);
$totals = mysql_num_rows($result_cat);
}
?>
<style type="text/css">
.style1 {
font-size: 14px;
color: #333333;
}
.style2 {color: #333333}
.style3 {color: #646464}
</style>
<table width="300" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="#619CA0" bordercolordark="#FFFFFF">
<tr>
<td height="30" background="images/bgre.jpg"><div align="center" class="unnamed1 style12"><strong>รายงานสรุป</strong><br>
<?
if ($_REQUEST['search']=="2") {
echo "ประจำเดือน $key";
} elseif ($_REQUEST['search']=="3") {
echo "ประจำปี $y";
}
?>
</td>
</tr>
<tr>
<td height="30" align="center" class="style2">
<FORM name="searchOrders" action="main.php?menu=report&by=date" method="post"> ค้นหา ตาม
<input name="search" type="radio" value="1" checked> วันที่..
<input name="search" type="radio" value="2"> เดือน...ประจำปี...
<input name="search" type="radio" value="3"> ปี...
<input name="search" type="radio" value="4"> ทั้งหมด <br>
<select name="month">
<OPTION value=0 selected>-------</OPTION>
<?
$thai_m=array("","มกราคม","กุมภาพันธ์","มีนาคม","เมษายน","พฤษภาคม","มิถุนายน","กรกฎาคม","สิงหาคม","กันยายน","ตุลาคม","พฤศจิกายน","ธันวาคม");
for ($i=1;$i<=12;$i++) {
if (strlen($i)=="1") {
echo "<OPTION value='0$i'>$thai_m[$i]</OPTION> ";
} else {
echo "<OPTION value='$i'>$thai_m[$i]</OPTION> ";
}
}
?>
</select>
<INPUT maxLength="4" name="year" size="4" value="<?=date("Y")+543;?>">
<input type="submit" value="ค้นหา" name="B1">
</FORM>
</td>
</tr>
<tr>
<td>
<table width="1000" border="0" align="center" cellpadding="5" cellspacing="1">
<tr bgcolor="#F4F4F4">
<td width="100" align="center" class="style1 style3">เลขหมายADSL</td>
<td width="100" align="center" class="style1 style3">วันที่ติดต่อ</td>
<td width="120" align="center" class="style1 style3">DSLAM</td>
<td width="95" align="center" class="style1 style3">ศูนย์</td>
<td width="200" align="center" class="style1 style3">ชุมสาย</td>
<td width="10" align="center" class="style1 style3">R</td>
<td width="10" align="center" class="style1 style3">SH</td>
<td width="10" align="center" class="style1 style3">SL</td>
<td width="10" align="center" class="style1 style3">P</td>
<td width="10" align="center" class="style1 style3">ATM/IP</td>
<td width="20" align="center" class="style1 style3">Speed</td>
<td width="10" align="center" class="style1 style3">Sync</td>
<td width="300" align="center" class="style1 style3">บริการที่ขอรับ</td>
</tr>
<?
if ($result_cat != ""){
while ($dbarr_cat = mysql_fetch_array($result_cat)) {
$dbarrp="";
$sql_m="select * from tbaddadsl where num_adsl ";
$result_m = mysql_query($sql_m);
$dbarr_m=mysql_fetch_array($result_m);
$total_m=mysql_num_rows($result_m);
$sqlm= "select * from tbdslam where dslamid='$dbarr_cat[ref_dslamid]'";
$resultm= mysql_query($sqlm);
$dbarrm= mysql_fetch_array($resultm);
$sqlhoming= "select * from tbhoming where homingid='$dbarr_cat[ref_homingid]'";
$resulthoming= mysql_query($sqlhoming);
$dbarrhoming= mysql_fetch_array($resulthoming);
$sqlex= "select * from tbexchange where exchangeid='$dbarr_cat[ref_exchangeid]'";
$resultex= mysql_query($sqlex);
$dbarrex= mysql_fetch_array($resultex);
$sqlsp= "select * from tbspeed where speedid='$dbarr_cat[ref_speedid]'";
$resultsp= mysql_query($sqlsp);
$dbarrsp= mysql_fetch_array($resultsp);
if ($dbarr_cat[service_status] != ""){
$dbarrp ="ถามสถานะ"." ";
}
if ($dbarr_cat[service_resetport] != ""){
$dbarrp =$dbarrp."Reset Port"." , ";
}
if ($dbarr_cat[service_adsl] != ""){
$dbarrp =$dbarrp."ปรึกษา ADSL"." , ";
}
if ($dbarr_cat[service_send] != ""){
$dbarrp =$dbarrp."ส่ง จสน."." , ";
}
if ($dbarr_cat[service_setmodem] != ""){
$dbarrp =$dbarrp."Set Modem"." , ";
}
if ($dbarr_cat[service_test] != ""){
$dbarrp =$dbarrp."test P/W"." , ";
}
if ($dbarr_cat[service_cut] != ""){
$dbarrp =$dbarrp."ตัด/ต่อ"." , ";
}
if ($dbarr_cat[service_changeport] != ""){
$dbarrp =$dbarrp."ย้าย Port"." , ";
}
if ($dbarr_cat[service_test2] != ""){
$dbarrp =$dbarrp."Test 2+"." , ";
}
if ($dbarr_cat[service_changespeed] != ""){
$dbarrp =$dbarrp."ปรับสปีด"." , ";
}
if ($dbarr_cat[service_openport] != ""){
$dbarrp =$dbarrp."เปิด Port"." , ";
}
if ($dbarr_cat[service_iptv] != ""){
$dbarrp =$dbarrp."IP-TV";
}
if ($dbarr_cat[name_phone] != ""){
$dbarrp =$dbarrp."IP-TV"." [ ติดต่อกลับ คุณ ".$dbarr_cat[name_phone]." ]";
}
?>
<tr>
<td valign="left" align="left" class="style1 style3"><?=$dbarr_cat['num_adsl'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarr_cat['date'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarrm['dslamname'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarrhoming['homingname'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarrex['exchangename'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarr_cat['rack'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarr_cat['shelf'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarr_cat['slot'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarr_cat['port'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarr_cat['type_ip'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarrsp['speeddetail'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarr_cat['sync'];?></td>
<td valign="left" align="left" class="style1 style3"><?=$dbarrp;?></td>
</tr>
<?
}
}
?>
<td colspan="6" align="right">มีทั้งหมด <?=$totals;?> รายการ :
<?
if ($totalpages>1) {
for ($i=1;$i<=$totalpages;$i++) {
if ($i == $page) {
echo "<b>หน้า $page</b>";
} else {
echo " | <a href=\"main.php?menu=report&by=date&page=$i\">$i</a> ";
}
}
}
?>
</td>
</tr>
<tr>
<td align="right">พิมพ์วันที่ : <?=displaycondate(date("Y-m-d"));?></td>
<tr>
</table>
</body>
</html>
Tag : PHP
|
|
|
|
|
|
Date :
2011-08-23 16:03:57 |
By :
ohmpanu |
View :
984 |
Reply :
2 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ลองใช้ดูแล้วคับ ก็ ยังไม่ขึ้นหน้า 2 อะคับ
|
|
|
|
|
Date :
2011-08-29 16:14:09 |
By :
ohmpanu |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|