<? ob_start(); session_start(); if($_SESSION["adminlogin"]=="") { header('location:index.php'); exit(); } include('../connect/connect.php'); mysql_query("SET character_set_results=utf8"); mysql_query("SET character_set_client=utf8"); mysql_query("SET character_set_connection=utf8"); mysql_query("collation_connection = utf8_bin"); mysql_query("collation_database = utf8_bin"); mysql_query("collation_server = utf8_bin"); if($_GET["Action"]=="Delete") { $sql_del= "delete from cusorder where OrderNo='".$_GET["OrderNo"]."'"; $dbquery_del = mysql_query($sql_del,$conn); echo"<script language='JavaScript'>"; echo"alert('ลบข้อมูลเรียบร้อยแล้ว');"; echo"window.location='menu.php?rs=co&ac=del';"; echo"</script>"; } ?> <? class DB{ function query($query){ $QID = mysql_query($query); mysql_query("SET character_set_results=utf8"); mysql_query("SET character_set_client=utf8"); mysql_query("SET character_set_connection=utf8"); mysql_query("collation_connection = utf8_bin"); mysql_query("collation_database = utf8_bin"); mysql_query("collation_server = utf8_bin"); if(!$QID){ echo "<br><br><b><font face='MS Sans Serif' size='1' color='#000099'>Query : \"$query\" </font><br> <font face='MS Sans Serif' size='1' color='#FF0000'>Error : \"".mysql_error()."\"</font></b> <br>"; exit; return $QID; }else{ return $QID; } } } $db = new DB; ?> <html> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <link rel="stylesheet" href="../css/styles.css" type="text/css"> <style type="text/css"> <!-- .style3 {font-size: 16px} .style4 {color: #FF0000} --> </style> <span class="style3"><br> </span> <table cellspacing=1 cellpadding=4 width="68%" bgcolor=#CCCCCC border=0 align="center" height="10"> <tbody> <tr bgcolor=#e5e5e5> <td width="100%" bgcolor="#FFFFCC" class="style3"><div align="center"></div> <table cellspacing=1 cellpadding=4 width="100%" border=0 align="center" height="10"> <tbody> <tr bgcolor=#e5e5e5> <td width="24%" bgcolor="#FFFFcc"><div align="left"><b>รายการสั่งซื้อ</b></div></td> <td width="15%" align="middle" bgcolor="#FFFFcc"><div align="left"> </div></td> <td width="58%" bgcolor="#FFFFCC"><div align="right"><a href="menu.php">กลับไป</a></a></div></td> <td width="3%" bgcolor="#FFFFcc"></td> </tr> </tbody> </table></td> </tr> </tbody> </table> <span class="style3"> <? $txt_search = $_GET['txt_search']; //$condition = " "; if(trim($_GET[txt_search])<>''){ //$txt_search= strtoupper($txt_search); $condition = "where OrderNo like '%$txt_search%'"; } $offset = $_GET['offset']; if (!isset($offset) || $offset < 0) { $offset=0; } // Set $limit, $limit = Max number of results per 'page' if(!$limit){ $limit = 15; } // Set $totalrows = total number of rows that unlimited query would return // (total number of records to display across all pages) //$sql = "select * from cusorder $condition"; $sql = "select * from cusorder ".$condition; $query_data = $db->query($sql); $rows = mysql_num_rows($query_data); // Set $begin and $end to record range of the current page $begin =($offset+1); $end = ($begin+($limit-1)); if ($end > $totalrows) { $end = $totalrows; } $Show = $sql." ORDER BY OrderNo desc LIMIT $offset, $limit"; $query_data = $db->query($Show); ?> </span> <form action="menu.php" method="get" name="form1" class="style3" id="form1"> <table width="68%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="#CCCCCC"> <tr bgcolor="#FFFFFF"> <td height="30" colspan="11" bgcolor="#FFFFCC"><table width="100%" border="0" cellpadding="0" cellspacing="0" bgcolor="#FFFFCC"> <tr> <tr> <tr> <td bgcolor="#FFFFCC"><div align="right"></div></td> </table> <tr bgcolor="#FFFFFF"> <td width="16%" bgcolor="#FFFFCC"><div align="center">เลขที่ใบสั่งซื้อ</div></td> <td width="34%" bgcolor="#FFFFCC">ชื่อ</td> <td width="24%" bgcolor="#FFFFCC"><div align="center">วัน/เดือน/ปี</div></td> <td width="18%" bgcolor="#FFFFCC"><div align="center">สถานะ</div></td> </tr> <? if($rows<>0){ $i=1; while($result_data = mysql_fetch_array($query_data)){ $check=$db->query(" select * from cusorder $condition "); $cli=$i%2; if($cli=="0") {$cli="#FFFFFF" ; } else { $cli="#FFFFFF" ; } ?> <? $sql="SELECT *FROM member WHERE MemberID ='$result_data[MemberID]'"; $result = mysql_query($sql); $rs = mysql_fetch_array($result); ?> <tr bgcolor="<?php echo "$cli"; ?>" > <? if($_GET['txt_search']!="") $linkOrder = "order_detail.php?OrderNo=".$result_data[OrderNo]."&rs=co&txt_search=".$_GET['txt_search']; else $linkOrder = "order_detail.php?OrderNo=".$result_data[OrderNo]."&rs=co"; ?> <td bgcolor="#FFFFCC"><span class="style2"><a href="<?=$linkOrder?>"> </span> <div align="left"><? print $result_data[OrderNo];?> </div></td> <td bgcolor="#FFFFCC"><a href="member_detail.php?MemberID=<? print $result_data[MemberID];?>&rs=pm"> <?=$rs["Name"];?> <?=$rs["LastName"];?> </a></td> <td bgcolor="#FFFFCC"><div align="left"><? print $result_data[Date];?> </div></td> <td bgcolor="#FFFFCC"><div align="left" class="style4"> <? if ($result_data["status"]=="1"){ echo"รอการตอบกลับ"; } else if ($result_data["status"]=="2"){ echo"รอการชำระเงิน"; }else if ($result_data["status"]=="3"){ echo"ชำระเงินเรียบร้อยแล้ว"; }else { echo"ทำการจัดส่งเรียบร้อยแล้ว"; } ?> </div></td> </tr> <? $i++; } }else{ ?> <tr bgcolor="#FFFFFF"> <td colspan="12" bgcolor="#FFFFCC"><div align="center" class="style6"> <p> </p> <font color="#FF0000"><strong>ไม่พบข้อมูล</strong></font> <p><a href="purchase.php">ย้อนกลับ</a></p> </div></td> </tr> <? } ?> </table> <p align="center"> </p> <table width="68%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <td bgcolor="#FFFFFF"><div align="right"> </div></td> </tr> </table> <? if($rows > 0){ ?> <table width="100%" border="0" align="center" cellpadding="3" cellspacing="0"> <tr class="style5"> <td> </td> <td> </td> </tr> <tr class="style5"> <td width="16%"> </td> <td width="84%"><strong class="style5">หน้าที่</strong> <?php // Begin Prev/Next Links // Don't display PREV link if on first page if ($offset !=0) { $prevoffset=$offset-$limit; echo "<a href='menu.php?rs=co&offset=$prevoffset&txt_search=$txt_search'> <font color=\"red\"><< ก่อนหน้า</font></a>\n\n"; } // Calculate total number of pages in result $pages = intval($rows/$limit); // $pages now contains total number of pages needed unless there is a remainder from division if ($rows%$limit) { // has remainder so add one page $pages++; } // Now loop through the pages to create numbered links // ex. 1 2 3 4 5 NEXT for ($i=1;$i<=$pages;$i++) { // Check if on current page if (($offset/$limit) == ($i-1)) { // $i is equal to current page, so don't display a link echo "<strong>$i </strong>"; } else { // $i is NOT the current page, so display a link to page $i $newoffset=$limit * ($i-1); echo "<a href='menu.php?rs=co&offset=$newoffset&txt_search=$txt_search' > <font color=\"black\">$i</font></a>\n\n"; } } // Check to see if current page is last page if (!((($offset/$limit)+1)==$pages) && $pages!=1) { // Not on the last page yet, so display a NEXT Link $newoffset=$offset+$limit; echo "<a href='menu.php?rs=co&offset=$newoffset&txt_search=$txt_search'> <font color=\"red\">ถัดไป>></font></a>\n"; } ?></td> </tr> </table> <? } ?> </form> <span class="style3"> <?php mysql_close($conn); ?> <?php //print $sql; ?> </span> </body></html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง