  | 
              
	              
	                
  
    
	 
        ต้องการทำระบบ ตรวจสอบสถานะเข้า-ออกของรถ ให้สถานะแสดงเป็น ไม่ว่างกับว่าง เขียนโค๊ดให้สลับกันตลอดทำยังไงคับ     | 
   
  
    |   | 
   
 
 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
<?php
// ตามความคิดผมน่ะ ไม่ต้องทำออกมาเป็น 2 ลำดับ เพราะ สิ่งที่จะเปลี่ยนไป มีแค่ status
// อยากรู้แค่ว่ารถอยู่หรือไม่อยู่
// ส่วนการเก็บประวัติการใช้งานรถก็เป็นอีกเรื่อง
// ส่วนการที่จะทำให้มันสลับกันไม่จำเป็นครับ ใช้การอัพเดทข้อมูล
// status ครับ ก็ให้คลิกแล้วอัพเดทเลย
// เช่น มีปุ่มให้คลิกว่าเปลี่ยนสถานะ เมื่อคลิกแล้วก็ให้มันไปอัพเดทฐานข้อมูล จาก 1 ให้กลายเป็น 0
// แต่ถ้ามันเป็น 0 เมื่อคลิกก็ให้มันกลายเป็น 1 
// โดยใช้คำสั่ง UPDATE 
// กรณีที่ต้องการเก็บประวัติการใช้งาน ก็ค่อยเพิ่ม ฟิว อื่นๆ เข้ามาครับ
$st1 = $result['status'];
if($st1 == "1")
{
	$t = "ว่าง";
}else if($st1 == "0"){
	$t = "ไม่ว่าง";
}
echo $t;
?>
                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-07-10 15:00:44 | 
                        By :
                            nobetaking | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ขอบคุนคับ แต่่ทดลองแล้วมันยังไม่ได้คับ ขึ้นค่าเดิมตลอดเลยคับ 
                         
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-07-11 12:08:47 | 
                        By :
                            phanat | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 เอาโค้ดที่ว่าทดลองแล้วมาด้วยครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-07-11 18:18:05 | 
                        By :
                            deawx | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                   ตอบความคิดเห็นที่ : 3 เขียนโดย : deawx เมื่อวันที่ 2018-07-11 18:18:05 
รายละเอียดของการตอบ ::
  ขอบคุนคับ นี้คับโค๊ด  Code (PHP)
<table width="1024" align="center">
  <tr>
    <td valign="top">
    <title>insert</title>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<body background="images/พื้นหลัง.png" >
<p>
  <?php 
	   
	    
	  ini_set('display_errors',1);
      error_reporting(~0);
	  
      $serverName = "localhost";
      $userName = "root";
      $userPassword = "12345678";
      $dbName = "myproject";
	  
      $conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
      mysqli_query($conn,"SET CHARACTER SET UTF8");
	 
?> 
  <?php
	 
	  $car= array('Car1','Car2'); 
	  $license_plate= array('SKA'=>"กข 2561 สงขลา" ,'PLG'=>"กค 2018 พัทลุง"); 
	  
     $sql = "INSERT INTO project (id,name,license_plate,status,date) VALUES ('".null."','".$car[0]."','".$license_plate['SKA']."','"."0"."',now())"; $query = mysqli_query($conn,$sql);
	
     //$sql = "INSERT INTO project (id,name,license_plate,status,date) VALUES ('".null."','".$car[0]."','".$license_plate['SKA']."','"."1"."',now())"; $query = mysqli_query($conn,$sql);
	 
      if($query) {
      echo "<h1 align=center>เชื่อมต่อฐานข้อมูลเรีบยร้อยแล้ว !!</h1>";
      }
      mysqli_close($conn);
?>
  
  
  <table width="900" align="center">
    <tr>
      <td>
      <!DOCTYPE html>
<html lang="en">
<head>
  <title>PHP Line Notify ทดสอบส่งไลน์ผ่านเว็บด้วย PHP</title>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  <style>
    /* Set height of the grid so .sidenav can be 100% (adjust if needed) */
    .row.content {height: 1500px}
    
    /* Set gray background color and 100% height */
    .sidenav {
      background-color: #f1f1f1;
      height: 100%;
    }
    
    /* Set black background color, white text and some padding */
    footer {
      background-color: #555;
      color: white;
      padding: 15px;
    }
    
    /* On small screens, set height to 'auto' for sidenav and grid */
    @media screen and (max-width: 767px) {
      .sidenav {
        height: auto;
        padding: 15px;
      }
      .row.content {height: auto;} 
    }
  </style>
  <body>
<div class="container-fluid">
<div class="row content">
  
<?php 
if ($_POST) {
	 
//Setting
$lineapi = "TTMCcr2fRD4VX6xnLSCFkkmGFSjV5S7FkZXdsfX3vUm";
  
  date_default_timezone_set('Asia/Bangkok');
  $datenow = date ('เวลา : H:i:s  D-d-F-Y ');
  
   $license_plate= array('SKA'=>" ชื่ออุปกรณ์ : Car-1 , ทะเบียน : กข 2561 สงขลา " ,'PLG'=>" ชื่ออุปกรณ์ : Car-2 , ทะเบียน : กค 2018 พัทลุง "); 
   $status= array('0'=>" สถานะ : ไม่ว่าง ",'1'=>" สถานะ : ว่าง ");
  
//$mms =  trim($_POST['textArea']);
$mms1 =  ($license_plate["SKA"]);
$mms2 =  ($status["1"]);
$mms3 =  ($datenow);
 
//date_default_timezone_set("Asia/Bangkok");
//line Send
$chOne = curl_init(); 
curl_setopt( $chOne, CURLOPT_URL, "https://notify-api.line.me/api/notify"); 
// SSL USE 
curl_setopt( $chOne, CURLOPT_SSL_VERIFYHOST, 0); 
curl_setopt( $chOne, CURLOPT_SSL_VERIFYPEER, 0); 
//POST 
curl_setopt( $chOne, CURLOPT_POST, 1); 
// Message 
curl_setopt( $chOne, CURLOPT_POSTFIELDS, "message=$mms1,$mms2,$mms3"); 
// follow redirects 
curl_setopt( $chOne, CURLOPT_FOLLOWLOCATION, 1); 
//ADD header array 
$headers = array( 'Content-type: application/x-www-form-urlencoded', 'Authorization: Bearer '.$lineapi.'', ); 
curl_setopt($chOne, CURLOPT_HTTPHEADER, $headers); 
//RETURN 
curl_setopt( $chOne, CURLOPT_RETURNTRANSFER, 1); 
$result = curl_exec( $chOne ); 
//Check error 
if(curl_error($chOne)) { echo 'error:' . curl_error($chOne); } 
else { $result_ = json_decode($result, true); 
echo "status : ".$result_['status']; echo "message : ". $result_['message']; } 
//Close connect 
curl_close( $chOne );      
}
?>
</div>
</div>
</body>
</html>
      </td>
    </tr>
  </table>
  <p>  
                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2018-07-11 20:44:20              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-07-11 20:42:03 | 
                        By :
                            phanat | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
นี้มัน Code INSERT ไม่ใช้ Code SELECT น่ะครับ
                         
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-07-12 08:19:54 | 
                        By :
                            Hararock | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                   ตอบความคิดเห็นที่ : 5 เขียนโดย : Hararock เมื่อวันที่ 2018-07-12 08:19:54 
รายละเอียดของการตอบ ::
  ขอโทษคับ     อันนี้เป็นโค๊ดที่ใช้แสดงตารางคับ   Code (PHP)
<?php require_once('../Connections/Myconnect.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $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;
}
}
mysql_select_db($database_Myconnect, $Myconnect);
$query_Myproject = "SELECT * FROM project";
$Myproject = mysql_query($query_Myproject, $Myconnect) or die(mysql_error());
$row_Myproject = mysql_fetch_assoc($Myproject);
$totalRows_Myproject = mysql_num_rows($Myproject);
?>
<!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>show1</title>
<script type="text/javascript">
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
</head>
<body  background="images/พื้นหลัง.png" onload="MM_preloadImages('images/หน้าแรก02.jpg','images/ตาราง101.jpg','images/ตาราง201.jpg','images/ผู้จัดทำ01.jpg','images/images/หน้าแรก2.jpg','images/images/ตารางที่12.jpg','images/images/ตารางที่22.jpg','images/images/ผู้จัดทำ2.jpg','images/images/ว่าง2.jpg')">
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="256" height="200"><table width="1024" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td><img src="images/หัวเว็บไซต์.jpg" width="1024" height="200" /></td>
        </tr>
    </table></td>
  </tr>
</table>
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="256" height="75"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/images/หน้าแรก2.jpg',1)"></a><a href="home.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/images/หน้าแรก2.jpg',1)"><img src="images/images/หน้าแรก1.jpg" width="256" height="75" id="Image2" /></a><a href="home.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image2','','images/หน้าแรก02.jpg',1)"></a></td>
    <td width="256" height="75"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/images/ตารางที่12.jpg',1)"></a><a href="show01.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/ตาราง101.jpg',1)"></a><a href="show1.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image3','','images/images/ตารางที่12.jpg',1)"><img src="images/images/ตารางที่11.jpg" width="256" height="75" id="Image3" /></a></td>
    <td width="256" height="75"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/images/ตารางที่22.jpg',1)"></a><a href="null.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image6','','images/images/ว่าง2.jpg',1)"><img src="images/images/ว่าง1.jpg" width="256" height="75" id="Image6" /></a><a href="show2.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/images/ตารางที่22.jpg',1)"></a><a href="show02.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image4','','images/ตาราง201.jpg',1)"></a></td>
    <td width="256" height="75"><a href="#" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/images/ผู้จัดทำ2.jpg',1)"></a><a href="about.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/ผู้จัดทำ01.jpg',1)"></a><a href="about.html" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Image5','','images/images/ผู้จัดทำ2.jpg',1)"><img src="images/images/ผู้จัดทำ1.jpg" width="256" height="75" id="Image5" /></a></td>
  </tr>
  <tr>
    <td height="450" colspan="4" align="center" valign="top" bgcolor="#FFFFFF"><p> </p>
      <p><mark><b>แสดงตาราง ระบบตรวจสอบสถานะเข้า-ออกของรถ</b></mark></p>
      <table border="1">
        <tr>
          <td align="center" bgcolor="#FFFF66">ลำดับที่</td>
          <td align="center" bgcolor="#FFFF66">ชื่ออุปกรณ์</td>
          <td align="center" bgcolor="#FFFF66">ทะเบียน</td>
          <td align="center" bgcolor="#FFFF66">สถานะ</td>
          <td align="center" bgcolor="#FFFF66">เวลา</td>
        </tr>
        <?php do { ?>
        	
        <?
			/*$s = $row_Myproject['status']; 
			{
				if ($s == 0 ) $t = "ไม่ว่าง";
				if ($s == 1 ) $t = "ว่าง";
			}
			*/
			
			$st1 = $row_Myproject['status'];
			if($st1 == "1")
			{
			$t = "ว่าง";
			}else if($st1 == "0"){
			$t = "ไม่ว่าง";
			}
			//echo $t;
			
			?>  
          <tr bgcolor="#FFFFCC">
            <td><?php echo $row_Myproject['id']; ?></td>
            <td><?php echo $row_Myproject['name']; ?></td>
            <td><?php echo $row_Myproject['license_plate']; ?></td>
            <td><?php $row_Myproject['status'];  ?><?php echo $t;?></td>
            <td><?php echo $row_Myproject['date']; ?></td>
          </tr>
          <?php } while ($row_Myproject = mysql_fetch_assoc($Myproject)); ?>
      </table>
<p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p>
    <p> </p></td>
  </tr>
</table>
<table width="1024" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><img src="images/ท้ายเว็บไซต์.jpg" width="1024" height="120" /></td>
  </tr>
</table>
</body>
</html>
<?php
mysql_free_result($Myproject);
?>
                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2018-07-12 09:32:05              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-07-12 09:12:48 | 
                        By :
                            phanat | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                   ตอบความคิดเห็นที่ : 7 เขียนโดย : Hararock เมื่อวันที่ 2018-07-12 11:48:05 
รายละเอียดของการตอบ ::
  ผมลองทำการเพิ่มโค๊ดที่ว่าลงไปแล้วนะคับทั้ง 2 โค๊ด  แต่ยังขึ้น "ไม่ว่างไม่ว่างไม่ว่าง" ค่าเหมือนเดิมตลอดคับ ลองลบบรรทัด 108-114 ออก แล้วเพิ่มบรรทัด 122 ตามที่ให้มา
 Code (PHP)
 <td><?php echo $row_Myproject['id']; ?></td>
            <td><?php echo $row_Myproject['name']; ?></td>
            <td><?php echo $row_Myproject['license_plate']; ?></td>
            <td> <?php $status = $row_Myproject['status']; if($status == 1){echo "ว่าง"; }else{ echo "ไม่ว่าง";} ?> </td>
            <td><?php echo $row_Myproject['date']; ?></td>
 
 
แล้วก็เปลี่ยนโค๊ดใน  INSERT บรรทัด 23-37 เป็น 
Code (PHP) 
<?php
	 
	  $car= array('Car1','Car2'); 
	  $license_plate= array('SKA'=>"กข 2561 สงขลา" ,'PLG'=>"กค 2018 พัทลุง"); 
	  
     $sql = "INSERT INTO project (id,name,license_plate,status,date) VALUES ('".null."','".$car[0]."','".$license_plate['SKA']."','".""."',now())"; $query = mysqli_query($conn,$sql);
     
     if($query) {
     echo "<h1 align=center>เชื่อมต่อฐานข้อมูลเรีบยร้อยแล้ว !!</h1>";
     }
      mysqli_close($conn);
?>
 
หรือว่าผมแก้ไขผิดจุดคับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-07-12 14:21:14 | 
                        By :
                            Aeyean | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                   ตอบความคิดเห็นที่ : 14 เขียนโดย : Aeyean เมื่อวันที่ 2018-07-13 09:25:47 
รายละเอียดของการตอบ ::
  ได้แล้วคับ ลงไว้เผื่อคใครต้องการในอนาคต
  Code (PHP) 
<?php
	 
	  $car= array('Car1','Car2'); 
	  $license_plate= array('SKA'=>"กข 2561 สงขลา" ,'PLG'=>"กค 2018 พัทลุง"); 
	  
	  $license_plate_SKA = $license_plate['SKA'];
	  /////////////////////////////////////// get last row of car
	  $query_Myproject = "SELECT * FROM project WHERE license_plate = '".$license_plate_SKA."' ORDER BY id DESC LIMIT 2";
    $Myproject = mysqli_query($conn, $query_Myproject) or die(mysql_error());
    $row_Myproject = mysqli_fetch_assoc($Myproject);
	$toggle_id = $row_Myproject['status'] == 2 ? 1 : 2;
	  
     $sql = "INSERT INTO project (id,name,license_plate,status,date) VALUES ('".null."','".$car[0]."','".$license_plate['SKA']."','".$toggle_id."',now())";
     $query = mysqli_query($conn,$sql);
     if($query) {
     echo "<h1 align=center>เชื่อมต่อฐานข้อมูลเรีบยร้อยแล้ว !!</h1>";
     }
      mysqli_close($conn);
?>
  
 
//////////////// ไฟล์ insert ส่งไปยงฐานข้อมูล///////////////////////// 
Code (PHP) 
<?php 
if ($_POST) {
	 
	 $serverName = "localhost";
      $userName = "root";
      $userPassword = "12345678";
      $dbName = "myproject";
	  
      $conn = mysqli_connect($serverName,$userName,$userPassword,$dbName);
	 
//Setting
$lineapi = "TTMCcr2fRD4VX6xnLSCFkkmGFSjV5S7FkZXdsfX3vUm";
  
  date_default_timezone_set('Asia/Bangkok');
  $datenow = date ('เวลา : H:i:s  D-d-F-Y ');
  
   $license_plate= array('SKA'=>" ชื่ออุปกรณ์ : Car-1 , ทะเบียน : กข 2561 สงขลา " ,'PLG'=>" ชื่ออุปกรณ์ : Car-2 , ทะเบียน : กค 2018 พัทลุง "); 
    //$status= array('2'=>" สถานะ : ไม่ว่าง ",'1'=>" สถานะ : ว่าง ");
  
  	$license_plate_query = array('SKA'=>"กข 2561 สงขลา" ,'PLG'=>"กค 2018 พัทลุง"); 
	/////////////////////////////////////////////////////  
  	$query_Myproject = "SELECT * FROM project WHERE license_plate = '".$license_plate_query["SKA"]."' ORDER BY id DESC LIMIT 2";
    $Myproject = mysqli_query($conn, $query_Myproject) or die(mysql_error());
    $row_Myproject = mysqli_fetch_assoc($Myproject);
  
//$mms =  trim($_POST['textArea']);
$mms1 =  ($license_plate["SKA"]);
$mms2 =  ($toggle_id  == 2 ? " สถานะ : ไม่ว่าง " : " สถานะ : ว่าง ");
$mms3 =  ($datenow);
 
//date_default_timezone_set("Asia/Bangkok");
//line Send
$chOne = curl_init(); 
curl_setopt( $chOne, CURLOPT_URL, "https://notify-api.line.me/api/notify"); 
// SSL USE 
curl_setopt( $chOne, CURLOPT_SSL_VERIFYHOST, 0); 
curl_setopt( $chOne, CURLOPT_SSL_VERIFYPEER, 0); 
//POST 
curl_setopt( $chOne, CURLOPT_POST, 1); 
// Message 
curl_setopt( $chOne, CURLOPT_POSTFIELDS, "message=$mms1,$mms2,$mms3"); 
// follow redirects 
curl_setopt( $chOne, CURLOPT_FOLLOWLOCATION, 1); 
//ADD header array 
$headers = array( 'Content-type: application/x-www-form-urlencoded', 'Authorization: Bearer '.$lineapi.'', ); 
curl_setopt($chOne, CURLOPT_HTTPHEADER, $headers); 
//RETURN 
curl_setopt( $chOne, CURLOPT_RETURNTRANSFER, 1); 
$result = curl_exec( $chOne ); 
//Check error 
if(curl_error($chOne)) { echo 'error:' . curl_error($chOne); } 
else { $result_ = json_decode($result, true); 
echo "status : ".$result_['status']; echo "message : ". $result_['message']; } 
//Close connect 
curl_close( $chOne );      
}
?>
  
/////////////////////// ไฟล์ insert ส่งเข้าไลน์ /////////////////////////// 
Code (PHP) 
<?php do { ?>
        	
        <?
			
			?>  
          <tr bgcolor="#FFFFCC">
            <td><?php echo $row_Myproject['id']; ?></td>
            <td><?php echo $row_Myproject['name']; ?></td>
            <td><?php echo $row_Myproject['license_plate']; ?></td>
            <td> <?php $status = $row_Myproject['status']; if($status == 2 ){echo "ไม่ว่าง"; }else{ echo "ว่าง";} ?> </td>
            <td><?php echo $row_Myproject['date']; ?></td>
          </tr>
          <?php } while ($row_Myproject = mysql_fetch_assoc($Myproject)); ?>
 
///////////////ไฟล์ show ตาราง //////////////////                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-07-19 10:51:54 | 
                        By :
                            Aeyean | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |