|
|
|
แบ่งหน้ามาหลายวันแล้วไม่ได้สักที คือว่าลองนำโค้ดแบ่งหน้าจากเว็บนี้ และก็ของเพื่อนที่ทำได้แล้วมาลองทำดู ยังไงๆ ก็ไม่ได้สักที รบกวนทีนะคะ |
|
|
|
|
|
|
|
<?
session_start();
if ($sess_yuphavadeeid<>session_id()) {
header( "Location: admin.php"); exit();
}
include ("connect.php");
$sql="select * from tb_order ";
$result=mysql_db_query($dbname,$sql);
$number=mysql_num_rows($result);
$no=1;
$Per_Page =2;
if(!$Page)
$Page=1;
$Prev_Page = $Page-1;
$Next_Page = $Page+1;
$result = mysql_query($sql);
$Page_start = ($Per_Page*$Page)-$Per_Page;
$Num_Rows = mysql_num_rows($result);
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;
if(($Page>$Num_Pages) || ($Page<0))
print "<center><b>จำนวน $Page มากกว่า $Num_Pages ยังไม่มีข้อความ<b></center>";
$sql .= " select * from tb_order LIMIT $Page_start , $Per_Page";
//ส่วนแสดงผล
$result = mysql_query($sql);
?>
<HTML>
<HEAD><TITLE>Delivery สำหรับผู้ดูแลระบบ</TITLE></HEAD>
<BODY>
<?
include ("admin_menu.php");
if ($number<>0) {
echo "
<P><B>ใบสั่งซื้อสินค้า</B></P>
<TABLE BORDER=1>
<TR BGCOLOR=#CC99FF>
<TD><CENTER><B>รหัส</B></CENTER></TD>
<TD><CENTER><B>ชื่อ - สกล</B></CENTER></TD>
<TD><CENTER><B>เบอร์ติดต่อ</B></CENTER></TD>
<TD><CENTER><B>ราคารวม</B></CENTER></TD>
<TD><CENTER><B>[ลบ]</B></CENTER></TD>
</TR> ";
while($rs=mysql_fetch_array($result)) {
$id_order=$rs[id_order];
$code_order=sprintf("%05d",$id_order);
$name_order=$rs[name_order];
$tel_order=$rs[tel_order];
$total_order=$rs[total_order];
echo "
<TR>
<TD><A HREF=\"admin_order_view.php?id_order=$id_order\" TARGET=\"_blank\">$code_order</A></TD>
<TD>$name_order</TD>
<TD>$tel_order</TD>
<TD><CENTER>$total_order</CENTER></TD>
<TD><A HREF=\"admin_order_delete.php?id_order=$id_order\"
onclick=\"return confirm('ยืนยันลบใบสั่งซื้อสินค้า $code_order ออกจากระบบ')\">[ลบ]</A></TD>
</TR>
</TR>";
$no++;
}
echo "</TABLE>";
mysql_close();
}
?>
<div align="center"><br>
มีจำนวน Recored ทั้งหมด
<?= $Num_Rows;?>
รวมทั้งหมด : <b>
<?=$Num_Pages;?>
</b> หน้า :
<?/* สร้างปุ่มย้อนกลับ */
if($Prev_Page)
echo " <a href='$PHP_SELF?Page=$Prev_Page'><< ย้อนกลับ </a>";
for($i=1; $i<$Num_Pages; $i++){
if($i != $Page)
echo "[<a href='$PHP_SELF?Page=$i'>$i</a>]";
else
echo "<b> $i </b>";
}
/*สร้างปุ่มเดินหน้า */
if($Page!=$Num_Pages)
echo "<a href ='$PHP_SELF?Page=$Next_Page'> หน้าถัดไป>> </a>";
?>
</BODY>
</HTML>
|
|
|
|
|
Date :
19 ม.ค. 2551 00:36:25 |
By :
ผ่านมา |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณค่ะ ได้แล้วนะคะ
|
|
|
|
|
Date :
19 ม.ค. 2551 15:57:17 |
By :
kukkik |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|