<? if(!isset($start)){ $start = 0; } $limit = '10'; // แสดงผลหน้าละกี่หัวข้อ /* หาจำนวน record ทั้งหมด ปล. อันนี้ต้องใช้กับตัวแบ่งนะ ห้ามเอาออก*/ $Qtotal = mysql_query("select * from decription order by Reporton DESC"); //คิวรี่ คำสั่ง $total = mysql_num_rows($Qtotal); // หาจำนวน record /* คิวรี่ข้อมูลออกมาเพื่อแสดงผล */ $Query = mysql_query("select * from decription order by Reporton DESC LIMIT $start,$limit"); //คิวรี่คำสั่ง $totalp = mysql_num_rows($Query); // หาจำนวน record ที่เรียกออกมา $close = mysql_query("select * from decription where Status = '5'"); $c_num = mysql_num_rows($close); $intRows = 0; $num = 1; ?> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td bgcolor="#000000"><span class="style3">+ Add New Issues [<a href="add_issue.php" style="text-decoration:none">Add</a>]</span></td> <td bgcolor="#000000"> </td> </tr> </table> <br> <table width="999" border="0" cellpadding="0" cellspacing="0" class="style4"> <tr class="style3"> <td width="21"><strong>ID</strong></td> <!--<td><strong>Flag</strong></td>--> <td width="91"><strong>Description</strong></td> <td width="59"><strong>Project</strong></td> <td width="106"><strong>Organization</strong></td> <td width="74"><strong>Cateogry</strong></td> <td width="79"><strong>Report by</strong></td> <td width="159"><strong>Report on</strong></td> <td width="56"><strong>Priority</strong></td> <td width="68"><strong>Assigned to</strong></td> <td width="48"><strong>Status</strong></td> <td width="90"><strong>Last updated by<!--<br><br><br>--></strong></td> <td width="148"><strong>Last updated on<!--<br><br>--></strong></td> </tr></table> <table width="999" border="0" cellspacing="0" cellpadding="0" class="style4"> <? while($arr = mysql_fetch_array($Query)){ $intRows++; ?> <tr> <td width="21"><? echo $num;?></td> <!--<td>H</td>--> <td width="91"><a href="existing.php?id=<? echo $arr['ID_Dep'];?>" style="text-decoration:none"><? echo substr($arr['Detail'],0,10).'..'; ?></a></td> <td width="59"> <? $sql1 = mysql_query("select Name_Pro from project where ID_Pro = $arr[ID_Pro]"); while($pro = mysql_fetch_array($sql1)){ echo $pro['Name_Pro']; } ?> </td> <td width="106"> <? $sql2 = mysql_query("select Name_Org from organization where ID_Org = $arr[ID_Org]"); while($org = mysql_fetch_array($sql2)){ echo $org['Name_Org']; } ?> </td> <td width="74"> <? $sql3 = mysql_query("select Name_Cate from category where ID_Cate = $arr[ID_Cate]"); while($cate = mysql_fetch_array($sql3)){ echo $cate['Name_Cate']; } ?> </td> <td width="79"><? echo $arr['Reportby'];?></td> <td width="159"><? echo $arr['Reporton'];?></td> <td width="56"><? echo $arr['Priority'];?></td> <td width="68"> <? $sql4 = mysql_query("select Name_Ad from admin where ID_Ad = $arr[Assign]"); while($ad = mysql_fetch_array($sql4)){ echo $ad['Name_Ad']; } ?> </td> <td width="48"><? if($arr['Status'] == '1'){ echo "New"; }else if($arr['Status'] == '2'){ echo "In progress"; }else if($arr['Status'] == '3'){ echo "Fixed"; }else if($arr['Status'] == '4'){ echo "Re-opened"; }else if($arr['Status'] == '5'){ echo "Closed"; } ?></td> <td width="90"><? echo $arr['Updateby'];?></td> <td width="148"><? echo $arr['Updateon'];?></td> </tr> <? $num++; } ?> <tr> <td colspan="3"> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td colspan="12"> <? $page = ceil($total/$limit); // เอา record ทั้งหมด หารด้วย จำนวนที่จะแสดงของแต่ละหน้า /* เอาผลหาร มาวน เป็นตัวเลข เรียงกัน เช่น สมมุติว่าหารได้ 3 เอามาวลก็จะได้ 1 2 3 */ for($i=1;$i<=$page;$i++){ if($_REQUEST['page']==$i){ //ถ้าตัวแปล page ตรง กับ เลขที่วนได้ echo "[<a href='?start=".$limit*($i-1)."&page=$i' style='text-decoration:none'><B>$i</B></A>]"; //ลิ้งค์ แบ่งหน้า เงื่อนไขที่ 1 }else{ echo "[<a href='?start=".$limit*($i-1)."&page=$i' style='text-decoration:none'>$i</A>]"; //ลิ้งค์ แบ่งหน้า เงื่อนไขที่ 2 } } ?> </td> <td> </td> </tr> <tr> <td colspan="3">Total Issues: <? echo $total;?></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> <tr> <td colspan="3">Closed: <? echo $c_num; ?></td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table>
<html> <head> <title>Maintenance System : รายการแจ้งซ่อม</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"> <style type="text/css"> <!-- body { background-image: url(picture/bg.png); margin-left: 0%; margin-top: 0%; margin-right: 0%; margin-bottom: 0%; } .style8 {color: #FFFFFF} .style9 { color: #FF0000; font-size: 14px; } .style12 {color: #0000FF; font-size: 12px; } --> </style> </head> <body> <? $table='hold'; // ชื่อของ table ใน database $all_data=mysql_result(mysql_query("select count(*) from $table"),0); //จำนวนเรคคอร์ดทั้งหมด $pagesize=20; //จำนวนหน้าที่ต้องการแสดง $all_page=ceil($all_data/$pagesize); //จำนวนหน้า ถ้าหารไม่ลงตัวจะปัดขึ้น ?> <table width="80%" border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#FFFFFF"> <tr> <th valign="top" scope="col"><p> </p> <table width="80%" border="0" cellspacing="0" cellpadding="0"> <tr> <th scope="col"><div align="left"><img src="picture/hold.gif" width="333" height="76"></div></th> </tr> </table></th> </tr> <tr> <td valign="top"> <table width="80%" align="center" cellpadding="0" cellspacing="1" bordercolor="#000000"> <tr bgcolor="#990000"> <th bgcolor="#660000"><div align="center" class="style8"><font size="2">ลำดับ</font></div></th> <th bgcolor="#660000"> <div align="center" class="style8"><font size="2">ชื่อผู้แจ้ง</font></div></th> <th bgcolor="#660000"> <div align="center" class="style8"><font size="2">วันที่แจ้ง</font></div></th> <th bgcolor="#660000"> <div align="center" class="style8"><font size="2">หน่วยงาน</font></div></th> <th bgcolor="#660000"> <div align="center" class="style8"><font size="2">ศูนย์พื้นท</font>ี่</div></th> <th bgcolor="#660000"> <div align="center" class="style8"><font size="2">สถานที่</font></div></th> <th bgcolor="#660000"><div align="center" class="style8"><font size="2">อาการเสีย</font></div></th> <th bgcolor="#660000"><div align="center" class="style8"><font size="2">สถานะ</font></div></th> </tr> <? $sql="select * from $table limit ".$now_page*$pagesize.",$pagesize"; $r=mysql_query($sql); while($objResult = mysql_fetch_array($r)) { ?> <tr bgcolor='#F9F9F9' onMouseOver="this.style.backgroundColor ='#FFE1A4'" onMouseOut="this.style.backgroundColor='#F9F9F9' "> <td align="center"><font color="#FF0000" size="2"> <a href="showhold2.php?id=<?echo $objResult["id"];?>" target="_blank"> [<?=$objResult["id"];?>] </a></font></td> <td><font color="#0000FF" size="2"><?=$objResult["name"];?></font></td> <td><font color="#0000FF" size="2"><?=$objResult["dates"];?></font></td> <td><font color="#0000FF" size="2"><?=$objResult["unit"];?></font></td> <td><font color="#0000FF" size="2"><?=$objResult["areas"];?></font></td> <td><font color="#0000FF" size="2"><?=$objResult["lives"];?></font></td> <td><font color="#FF0000" size="2"> <a href="showhold2.php?id=<?echo $objResult["id"];?>" target="_blank"><?=$objResult["baded"];?> </a></font></td> <td align="center"> <? if ($objResult["status"]==""){ echo "<IMG SRC='picture/wait.gif' ALT='รอเจ้าหน้าที่ดำเนินการ'>"; }else if ($objResult["status"]=="1"){ echo "<IMG SRC='picture/finish.gif' ALT='ดำเนินการเสร็จแล้ว'>"; }else{ echo "<IMG SRC='picture/icons.gif' ALT='อยู่ระหว่างการดำเนินการ'>"; } ?> </td> </tr> <? } ?> </table></td> </tr> <tr> <td align="center"><p> </p> <p><font color="#0000FF" size="2">รายการทั้งหมด</font> <B> <font color="#FF0000" size="2"><?=$all_data; ?></font> </B><font color="#0000FF" size="2">รายการ</font> <br> <font color="#0000FF" size="2">แสดงจำนวน </font><b> <font color="#FF0000" size="2"><?=$all_page; ?></font> </b> <font color="#0000FF" size="2">หน้า</font> <font color="#0000FF" size="2">แสดงหน้าละ </font><b> <font color="#FF0000" size="2"><?=$pagesize; ?></font> </b> <font color="#0000FF" size="2">รายการ</font> <br> <? // การแสดงเลขหน้าทั้งหมด for($number_page=0;$number_page<=$all_page-1;$number_page++) { echo '<font color=blue size=2> [ <A HREF="?now_page='.$number_page.'">'.intval($number_page+1).'</A> ] '; } ?> </p> <p> </p> <table width="40%" height="77" border="0" cellpadding="0" cellspacing="0"> <tr bgcolor="#666666"> <th height="18" colspan="6" bgcolor="#CCCCCC" scope="col"><div align="center" class="style9">สถานะการดำเนินงาน</div></th> </tr> <tr> <th height="59" bgcolor="#F9F9F9" scope="col"><div align="center" class="style12"> <div align="center"><img src="picture/wait.gif" width="14" height="14"></div> </div></th> <th bgcolor="#F9F9F9" scope="col"><div align="center" class="style12"> <div align="center">รอการดำเนินการ</div> </div></th> <th bgcolor="#F9F9F9" scope="col"><div align="center" class="style12"> <div align="center"><img src="picture/finish.gif" width="15" height="12"></div> </div></th> <th bgcolor="#F9F9F9" scope="col"><div align="center" class="style12"> <div align="center">ดำเนินการเสร็จแล้ว</div> </div></th> <th bgcolor="#F9F9F9" scope="col"><div align="center" class="style12"> <div align="center"><img src="picture/icons.gif" width="14" height="14"></div> </div></th> <th bgcolor="#F9F9F9" scope="col"><div align="center" class="style12"> <div align="center">อยู่ระหว่างการดำเนินการ</div> </div></th> </tr> </table> </tr> <tr> <td><? include "themefoot.php";?></td> </tr> </table> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง