  | 
              
	              
	                
  
    
	 
        สอบถามหน่อยครับ จะให้แสดค่าตามรูปภาพ ต้องทำยังไงครับ     | 
   
  
    |   | 
   
 
 
 
	
		
			  | 
	   | 
	    | 
		
			  | 
	 
	
		
			  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                   
 
Code (PHP) 
<?php require_once('Connections/helpdesk.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}
$maxRows_Recordset1 = 10;
$pageNum_Recordset1 = 0;
if (isset($_GET['pageNum_Recordset1'])) {
  $pageNum_Recordset1 = $_GET['pageNum_Recordset1'];
}
$startRow_Recordset1 = $pageNum_Recordset1 * $maxRows_Recordset1;
$colname_Recordset1 = "-1";
if (isset($_POST['word'])) {
  $colname_Recordset1 = $_POST['word'];
}
mysql_select_db($database_helpdesk, $helpdesk);
$query_Recordset1 = sprintf("SELECT id_servicerepair, informant, hardwareid, tel, date_informant, id_status, id_officer, detail_service FROM tbl_servicerepair WHERE hardwareid LIKE %s", GetSQLValueString("%" . $colname_Recordset1 . "%", "text"));
$query_limit_Recordset1 = sprintf("%s LIMIT %d, %d", $query_Recordset1, $startRow_Recordset1, $maxRows_Recordset1);
$Recordset1 = mysql_query($query_limit_Recordset1, $helpdesk) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
if (isset($_GET['totalRows_Recordset1'])) {
  $totalRows_Recordset1 = $_GET['totalRows_Recordset1'];
} else {
  $all_Recordset1 = mysql_query($query_Recordset1);
  $totalRows_Recordset1 = mysql_num_rows($all_Recordset1);
}
$totalPages_Recordset1 = ceil($totalRows_Recordset1/$maxRows_Recordset1)-1;
?>
<?php require_once('connect.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" />
<script type="text/javascript" src="scripts/jquery.js"></script>
<script type="text/javascript" src="scripts/functions.js"></script>
<title>รายงานแจ้งซ่อม</title>
<link href="style.css" rel="stylesheet" type="text/css"/>
<style type="text/css">
<!--
.style7 {font-size: 14; font-weight: bold; }
.style8 {font-size: 14px}
body,td,th {
	font-size: 12px;
}
-->
</style>
</head>
<body>
<?php require_once('header.php');?>
<?php
        $total_count = mysql::scalar(
			"SELECT COUNT(*) FROM tbl_servicerepair"
		);
        $limit = 15;		
        $page = (int)$_GET['page'];		
        $p = new Pager($total_count, $limit, $page);
		$start = $p->offset();
	  	$s = "SELECT * FROM tbl_servicerepair ORDER BY id_servicerepair DESC LIMIT $start,$limit";
	  	$r = mysql::query($s);		
	  ?>
<br />
<br />
<table width="100%" border="0" cellpadding="5">
  <tr>
    <td><strong><span class="style6">หน้า :</span> <span class="style3">รายงานแผนกเทคโนโลยีสารสนเทศ</span></strong></td>
  </tr>
  <tr>
    <td><a href="report/report-service-branch.php">จำแนกตามสาขา</a> | <a href="report/report-service-department.php">จำแนกตามแผนก</a> | <a href="report/report-service-category.php">สถิติแยกตามประเภทซ่อม</a> | <a href="report/report-officer.php">สถิติการทำงานของเจ้าหน้าที่ | </a><a href="repair-report-search.php">ค้นหาตามหมายเลขเครื่อง</a></a></td>
  </tr>
  <tr>
    <td><form id="form1" name="form1" method="post" action="repair-report-search.php">
      <label>
      <div align="center">
        <p><span class="style8">ค้นหา</span>
          <input name="word" type="text" id="Word" />
        </p>
        </div>
      <p align="center"><img src="images/png_1113.png" width="424" height="64" /></p>
      <table border="1" align="center">
        <tr>
          <td><div align="center"><span class="style7">หมายเลขเคส</span></div></td>
          <td><div align="center"><span class="style7">ชื่อผู้แจ้ง </span></div></td>
          <td><div align="center"><span class="style7">หมายเลขประจำเครื่อง</span></div></td>
          <td><div align="center"><span class="style7">เบอร์ โทร</span></div></td>
          <td><div align="center"><span class="style7">วันที่แจ้งซ่อม</span></div></td>
          <td><div align="center"><span class="style7">สถานะ</span></div></td>
          <td><div align="center"><span class="style7">ชื่อผู้ซ่อม</span></div></td>
          <td><div align="center"><span class="style7">วิธีซ่อม</span></div></td>
        </tr>
        <?php do { ?>
        <tr>
          <td><?php echo $row_Recordset1['id_servicerepair']; ?></td>
          <td><?php echo $row_Recordset1['informant']; ?></td>
          <td><?php echo $row_Recordset1['hardwareid']; ?></td>
          <td><?php echo $row_Recordset1['tel']; ?></td>
          <td><?php echo $row_Recordset1['date_informant']; ?></td>
          <td><?php echo $row_Recordset1['id_status']; ?></td>
          <td><?php echo $row_Recordset1['id_officer']; ?></td>
          <td><?php echo $row_Recordset1['detail_service']; ?></td>
        </tr>
        <?php } while ($row_Recordset1 = mysql_fetch_assoc($Recordset1)); ?>
      </table>
      <div align="center">
        <p>
          <input name="BTN" type="submit" id="BTN" value="Submit" />
          </p>
      </div>
      </label>
  </table>
        <br />
        <form id="form1" name="form1" method="post" action="">
        </form>
        <table width="38%" border="0" align="center">
          <tr>
            <td width="10%"><div align="center"><strong><span class="style3">หมายเหตุ :</span></strong></div></td>
            <td width="3%"><div align="center"><img src="images/1.gif" width="14" height="14" /></div></td>
            <td width="10%"><div align="center">รอการรับเรื่อง</div></td>
            <td width="7%"><div align="center"><img src="images/2.gif" width="47" height="23" /></div></td>
            <td width="12%"><div align="center">กำลังดำเนินงาน</div></td>
            <td width="3%"><div align="center"><img src="images/3.gif" width="15" height="12" /></div></td>
            <td width="14%"><div align="center">แก้ไขเสร็จเรียบร้อย</div></td>
          </tr>
        </table>
        <p> </p>
        <p> </p></td></form>    </td>
  </tr>
  
</table>
<form id="form2" name="form2" method="post" action="">
  <table width="100%" border="0" align="center" bgcolor="#666666">
    <tbody>
      <tr>
        <td bordercolor="#00CC33" bgcolor="#666666"><div align="center">
          <h1><strong>ระบบแจ้งซ่อมคอมพิวเตอร์ออนไลน์</strong></h1>
        </div></td>
      </tr>
      <tr>
 
 
  Tag : PHP, MySQL               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2015-06-07 14:43:07 | 
                      By :
                          lata191 | 
                      View :
                          789 | 
                      Reply :
                          7 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  | 
	 
	
		
			  | 
		  | 
		
			  | 
		
			  | 
	 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
$_CONFIG['status'][1] = 'รอการรับเรื่อง';
$_CONFIG['status'][2] = 'กำลังดำเนินงาน';
$_CONFIG['status'][3] = 'แก้ไขเสร็จเรียบร้อย';
echo $_CONFIG['status'][$row_Recordset1['id_status']];
                         
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2015-06-07 16:24:14 | 
                        By :
                            1241050 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                   
ใส code แล้ว error ตามรูปครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2015-06-08 08:01:39 | 
                        By :
                            lata191 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ------ของผมทำแบบนี้ครับ-------- 
 
ทำ Inner Join ระหว่าง table และบรรทัดที่ 127 เปลี่ยนจาก  
 
<?php echo $row_Recordset1['name_status']; ?>                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2015-06-08 08:25:24 | 
                        By :
                            saovarott159 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ------ของผมทำแบบนี้ครับ-------- 
 
ทำ Inner Join ระหว่าง table และบรรทัดที่ 127 เปลี่ยนจาก  
 
<?php echo $row_Recordset1['name_status']; ?> 
inber join ยังไงครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2015-06-08 08:48:25 | 
                        By :
                            lata191 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
<?php
$id = (int)$_GET['id'];
$r = mysql::query(
	"SELECT tbl_servicerepair.*, name_status FROM ".
		"tbl_servicerepair LEFT JOIN  tbl_status_servicerepair ".
		"ON tbl_servicerepair.id_status = id_status.name_status ".
		"WHERE id_status='$id'"
	);
if (mysql_num_rows($r) == 0):
	echo 'not found';
else:
	$rs = mysql_fetch_assoc($r);
?>
                         
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2015-06-08 11:37:35 | 
                        By :
                            lata191 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 เลือกเอาครับระหว่าง หนัก database server หรือ หนัก php (web server) 
แค่ถ้าอยู่เครื่องเดียวกัน แบบไหนก็เหมือนกัน 
 
ถ้า database กับ web อยู่คนละเครื่องกัน แนะนำให้ ใช้ php ช่วย แบบคห 2 ถูกแล้วครับ แต่ทำให้เป็น dynamic 
เพราะมี database อยู่แล้ว 
 
กำหนดเป็น array  
Code (PHP) 
$rs = $db->query( 'select id_status, name_status from tbl_status_servicerepair');
$config['status'] = array();
while( $ro=$rs->fetch_assoc()){
    $config['status'][$ro['id_status']]=$ro['name_status'];
}
                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2015-06-08 11:40:34              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2015-06-08 11:39:42 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |