|  |  | 
          
            | Code (PHP) 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ระบบตรวจสอบข้อมูลวันลาพนักงาน</title>
<style type="text/css">
a:hover    {text-decoration:none} 
<!--
body {
	background-color: #FFFFFF;
	background-image: url();	
}
.style21 {font-size: small}
-->
</style>
</head>
<body>
<table width="959" height="125" border="0" align="center">
  <tr>
    <th width="950" height="121" bgcolor="#FFFFFF" scope="col"><table width="100%" border="0" cellspacing="0">
      <tr>
        <th height="91" valign="top" scope="col"><img src="headder.jpg" width="818" height="80" /></th>
      </tr>
      <tr>
        <td height="21" valign="top"> </td>
      </tr>
    </table>
    </th>
  </tr>
</table>
<div align="center">
  <p>
    <?php
if($_POST['mode'] == "search" ){
	
	echo "<table border='1' width=50%>";
	
	if($_POST['username'] != "" and $_POST['pass'] != "") {
			
			//echo "?? ";
			$hostname = "localhost"; //?
			$user = "root"; //?
			$password = "root"; //??
			$dbname = "holiday"; //??
			//$tblname = "data"; //??
			$sql ="select *  from data where data. username ='".$_POST['username']."' and data. pass ='".$_POST['pass']."' ";
			
			//echo $sql;
			// ติด ต่อ database
			mysql_connect($hostname, $user, $password) or die("cannot connect");
			// เลือก database
			mysql_select_db($dbname) or die("cannot select db");
			
			// ทำให้ อ่านภาษาไทยได้ใน utf8 
			mysql_query("SET NAMES utf8");
			
			$result = mysql_query($sql) or die(mysql_error());
			$row_number = mysql_num_rows($result); // หาจำนวน แถว ข้อมูลที่ ค้นหาได้
			
		
			
               if($row_number > 0){
				while($record = mysql_fetch_array($result)){
					 	$record1=$record["id_user"];
						$record2=$record["username"];
						$record3=$record["pass"];
						$record4=$record["name"];
						$record5=$record["lastname"];
						$record6=$record["position"];
						$record7=$record["department"];
						
											
						
						
		?>				
  <tr bgcolor="#F3F7FE" bordercolor="#0033FF">
				<td style="font:Arial, Helvetica, sans-serif; color: #993399; text-align:center; font-size:14px; width:20%;"><b><?=$record4?> <?=$record5?></b></td>
				
				
				
	            <td style="font:tahoma; color:#00008B; text-align:center; font-size:12px; width:10%;"><a href="view_info1.php?id_user=<?=$record1?>">รายละเอียดข้อมูล</a></td>
				<td style="font:tahoma; color:#00008B; text-align:center; font-size:12px; width:20%;"><a href="form_add5.php?id_user=<?=$record1?>">ตรวจสอบวันลาย้อนหลัง<select name="$year_round">
   <option><? echo date("Y")+543;?></option>
   <? for($i=0;$i<=0;$i++){?>
   <option value="<? echo date("Y")+542+$i;?>"><? echo date("Y")+542+$i;?></option>
   <? }?>
 </select></a></td>
				
				
				
  </tr> 
   
		<p>
  <?php
				}
			
			}else{// ไม่พบข้อมูลที่ค้นหา
				echo "<tr><td colspan='8'><b><font color=ff0000>ไม่พบข้อมูลของคุณ...กรุณาลองใหม่อีกครั้ง</font></b></td></tr>";
			}
	//ไม่มีค่าส่งมา			
	}else{
		echo "<tr><td colspan='8' >กรุณาใส่ Username และ Password ของท่าน</td></tr>";	
	}
	
	echo "</table>";
}
?>
  </p>
</div>
<table width="818" height="91" border="0" align="center">
  <tr>
    <th width="818" height="87" background="footer copy.jpg" scope="col"> </th>
  </tr>
</table>
</body>
</html>
 Code (PHP)
 
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>ระบบตรวจสอบข้อมูลวันลาพนักงาน</title>
<style type="text/css">
<!--
body {
	background-color: #FFFFFF;
	background-image: url();	
}
.style21 {font-size: small}
-->
</style>
</head>
<body>
<table width="959" height="125" border="0" align="center">
  <tr>
    <th width="950" height="121" bgcolor="#FFFFFF" scope="col"><table width="100%" border="0" cellspacing="0">
      <tr>
        <th height="91" valign="top" scope="col"><img src="headder.jpg" width="818" height="80" /></th>
      </tr>
      <tr>
        <td height="21" valign="top"> </td>
      </tr>
    </table>
    </th>
  </tr>
</table>
<?php
	
	
			
			//echo "?? ";
			$hostname = "localhost"; //?
			$user = "root"; //?
			$password = "root"; //??
			$dbname = "holiday"; //??
			//$tblname = "date"; //??
			//$sql ="select * from date where id_user='$id_user'";
			
             $sql =" select * from data ,date  WHERE data.id_user='$id_user' and date.id_user='$id_user' and date.year_round='$year_round'";
             
			//echo $sql;
			// ติด ต่อ database
			mysql_connect($hostname, $user, $password) or die("cannot connect");
			// เลือก database
			mysql_select_db($dbname) or die("cannot select db");
			
			// ทำให้ อ่านภาษาไทยได้ใน utf8 
			mysql_query("SET NAMES utf8");
			
	
	
	$sqlquery=mysql_db_query($dbname, $sql); 
	
	
	
	$row = mysql_fetch_row($sqlquery);
				
			
				print "                                                                    <font size=2>ข้อมูลวันลาทั้งหมดของ  : ".$row[3] ."</font>  ";
				print "<font size=2>".$row[4] ."</font>";
			
			
			
			 
			 
			
			
	mysql_close();
?> <br> <br>
<?php
	$record1=$record["id_date"];
	
	
	
			
			//echo "?? ";
			$hostname = "localhost"; //?
			$user = "root"; //?
			$password = "root"; //??
			$dbname = "holiday"; //??
			//$tblname = "date"; //??
			//$sql ="select * from date where id_user='$id_user'";
			
             $sql =" select * from date ,data  WHERE data.id_user='$id_user' and date.id_user='$id_user' and date.year_round='2553'";
             
			//echo $sql;
			// ติด ต่อ database
			mysql_connect($hostname, $user, $password) or die("cannot connect");
			// เลือก database
			mysql_select_db($dbname) or die("cannot select db");
			
			// ทำให้ อ่านภาษาไทยได้ใน utf8 
			mysql_query("SET NAMES utf8");
			
	
	
	$sqlquery=mysql_db_query($dbname, $sql); 
	
	
	//print "มีข้อมูลทั้งหมด ".mysql_num_rows($sqlquery)." รายการ <br><br><br>";
	print "<table width=700 align=center border=1>";
			print "<tr bgcolor=0066FF>";
				print "<td align = center  width=20%><font color=ffffff size=2>ประเภทการลา</font></td>";
				print "<td align = center  width=20%><font color=ffffff size=2>วันเริ่มต้น</font></td>";
				print "<td align = center  width=20%><font color=ffffff size=2>วันสิ้นสุด</font></td>";
				print "<td align = center  width=17%><font color=ffffff size=2>รวมจำนวนวัน</font></td>";
				print "<td align = center  width=17%><font color=ffffff size=2>วันพักผ่อนคงเหลือ</font></td>";
		
				
			print "</tr>";
	while ($row = mysql_fetch_row($sqlquery)) 
			{
				
			print "<tr bgcolor=FFF8dc>";
				print "<td align = center><font size=2>".$row[11] ."</font></td>";
				print  "<td td align =center><font size=2> ".$row[2] ."  ".$row[3] ."  ".$row[4]."</font> </td>";
				print  "<td td align = center><font size=2> ".$row[5] ."  ".$row[6] ."  ".$row[7]."</font> </td>";
				print "<td align = center><font size=2>".$row[8] ."</font></td>";
				print "<td align = center><font size=2>".$row[10] ."</font></td>";
			
			print "</tr>";  
			
			 }
			 
			 print"</table><br><br>";
			
	mysql_close();
?>  
  </tr> 
   
		<p>
 
  </p>
</div>
<table width="818" height="91" border="0" align="center">
  <tr>
    <th width="818" height="87" background="footer copy.jpg" scope="col"> </th>
  </tr>
</table>
</body>
</html>
 
 
 Tag : PHP
 
 
 |  
            |  |  
            | 
              
                |  |  |  |  
                |  | 
                    
                      | Date :
                          2010-08-10 15:10:36 | By :
                          au_mutd | View :
                          1220 | Reply :
                          2 |  |  |  
                |  |  |  |  |  
            |  |  
		            |  |