<? session_start(); if ($_SESSION['log_level'] != 'admin') { echo "<script> alert(' User ที่คุณใช้ไม่สามารถใช้งานใน Page นี้ได้'); location = 'index.php' ; </script>"; exit(); } include "connect_db.inc.php"; $sql="select * from tb_employees order by emp_id asc "; $result=mysql_db_query($database_stock2,$sql); $number=mysql_num_rows($result); $no=1; ?> <html> <head> <title>Untitled Document</title> <meta http-equiv="Content-Type" content="text/html; charset=windows-874"> <style type="text/css"> <!-- @import url("styles2.css"); --> </style> </head> <body> <? if($number<>0){ ////////////////////////////////////////////////// //////////////////////////////////////////// echo " <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0' class='odd' > <tr class='odd'> <td><p><strong><a href=\"admin_employees_add_form.php\">[ <img src='images/add-user-icon.png' width='32' height='32' border='0' align='absmiddle'> เพิ่มพนักงาน ]</a></strong></p> </td> </tr> </table> <table width='100%' border='0' align='center' cellpadding='0' cellspacing='0'> <thead> <tr class='odd'> <td scope='col'>ลำดับที่</td> <td scope='col'>ชื่อ - นามสกุล</td> <td scope='col'>ตำแหน่ง</td> <td scope='col'>ฝ่าย</td> <td scope='col'>แก้ไข</td> <td scope='col'>ลบ</td> </tr> </thead> "; while($rs=mysql_fetch_array($result)){ $emp_id=$rs[emp_id]; $code_prd=sprintf("%05d",$emp_id); $emp_fname=$rs[emp_fname]; $emp_lname=$rs[emp_lname]; $ref_division_id=$rs[ref_division_id]; $ref_position_id=$rs[ref_position_id]; $ref_emp_title_id=$rs[ref_emp_title_id]; $sql3="select position_name from tb_positions where position_id='$ref_position_id' "; $result3=mysql_db_query($database_stock2,$sql3); $rs3=mysql_fetch_array($result3); $position_name=$rs3[position_name]; $sql2="select division_name from tb_divisions where division_id='$ref_division_id'"; $result2=mysql_db_query($database_stock2,$sql2); $rs2=mysql_fetch_array($result2); $division_name=$rs2[division_name]; $sql4="select emp_title_name from tb_emp_titles where emp_title_id='$ref_emp_title_id' "; $result4=mysql_db_query($database_stock2,$sql4); $rs4=mysql_fetch_array($result4); $emp_title_name=$rs4[emp_title_name]; echo " <tr class='column1' > <td scope='col'>$no</td> <td scope='col'>$emp_title_name $emp_fname $emp_lname</td> <td scope='col'>$division_name</td> <td scope='col'>$position_name</td> <td scope='col'><a href=\"admin_employees_edit.php?id_edit=$emp_id\"><img src='images/edit-user-icon.png' width='32' height='32' border='0' align='absmiddle'></a></td> <td scope='col'><a href=\"admin_employees_delete.php?id_del=$emp_id\" onclick=\"return confirm('ยืนยันลบอุปกรณ์ [ $emp_title_name $emp_fname $emp_lname ]')\"> <img src='images/remove-user-icon.png' width='32' height='32' border='0' align='absmiddle'> </a> </td> </tr> "; $no++; } echo "</table>"; //////////////////////// /////////////////////////// mysql_close(); } else { echo "<table class='column1' ><tr class='odd' ><td>"; echo "<h3>[ <a href=admin_employees_add_form.php><img src='images/add-user-icon.png' width='32' height='32' border='0' align='absmiddle'> เพิ่ม พนักงาน</a> ]</h3>"; echo "</td></tr></table><br><br><br>"; echo "<center>"; echo "<img src=\"images/empwarning.png\"><br><br>"; echo "<h5><font color=red><strong>[ ไม่มีข้อมูล + |กรุณาเพิ่มข้อมูลพนักงาน| ]</strong></font></h5>"; echo "</center>"; } ?> </body> </html>
<html> <head> <title>ThaiCreate.Com PHP & MySQL Tutorial</title> </head> <body> <? $objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database"); $objDB = mysql_select_db("mydatabase"); $strSQL = "SELECT * FROM customer "; $objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]"); $Num_Rows = mysql_num_rows($objQuery); $Per_Page = 2; // 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 .=" order by CustomerID ASC LIMIT $Page_Start , $Per_Page"; $objQuery = mysql_query($strSQL); ?> <table width="600" border="1"> <tr> <th width="91"> <div align="center">CustomerID </div></th> <th width="98"> <div align="center">Name </div></th> <th width="198"> <div align="center">Email </div></th> <th width="97"> <div align="center">CountryCode </div></th> <th width="59"> <div align="center">Budget </div></th> <th width="71"> <div align="center">Used </div></th> </tr> <? while($objResult = mysql_fetch_array($objQuery)) { ?> <tr> <td><div align="center"><?=$objResult["CustomerID"];?></div></td> <td><?=$objResult["Name"];?></td> <td><?=$objResult["Email"];?></td> <td><div align="center"><?=$objResult["CountryCode"];?></div></td> <td align="right"><?=$objResult["Budget"];?></td> <td align="right"><?=$objResult["Used"];?></td> </tr> <? } ?> </table> <br> Total <?= $Num_Rows;?> Record : <?=$Num_Pages;?> Page : <? if($Prev_Page) { echo " <a href='$_SERVER[SCRIPT_NAME]?Page=$Prev_Page'><< Back</a> "; } for($i=1; $i<=$Num_Pages; $i++){ if($i != $Page) { echo "[ <a href='$_SERVER[SCRIPT_NAME]?Page=$i'>$i</a> ]"; } else { echo "<b> $i </b>"; } } if($Page!=$Num_Pages) { echo " <a href ='$_SERVER[SCRIPT_NAME]?Page=$Next_Page'>Next>></a> "; } mysql_close($objConnect); ?> </body> </html>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง