  | 
              
	              
	                
  
    
	 
        Insert ข้อมูล 2 ตาราง จาก form เดียวไม่ได้ กรุณาขอคำแนะนำ แก้ไข ด้วยครับ     | 
   
  
    |   | 
   
 
 
 
	
		
			  | 
	   | 
	    | 
		
			  | 
	 
	
		
			  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                Code (PHP) 
$sql = "INSERT INTO reservations (res_userid,res_equid ,res_status ,reservation_date) VALUES ('".$_POST['txtuserid']."','".$_POST['txtequid']."','".$_POST['txtstatus']."','".$_POST['txtdate']."')";
				$query = mysqli_query($connect,$sql) or die (mysqli_error($connect));
				$sql2 = "INSERT INTO area_reservations (area_equid ,area_userid) VALUES ('".$_POST['txtequid']."','".$_POST['txtuserid']."')";
				$query2 = mysqli_query($connect,$sql2) or die (mysqli_error($connect));
				mysqli_close($connect);
				if ($query2) {
					header("Location:  $Group ");
				}
 
 
ตามโค๊ด  ผม insert 2 คำสั่งไม่ได้ครับ แต่ถ้า ลบออกไป 1 คำสั่ง มันก็เพิ่มได้ปกติ ซึ่งผมไม่เข้าใจ เป็นเพราะอะไร ทั้งๆไม่มีการแก้ไขหรือเปลี่ยนแปลง แต่ใน database auto_number ก็รันปกติ ทั้งสองตาราง แต่ไม่มีข้อมูล หรือ error อะไรแจ้งเลยครับ   ท่านที่รู้ช่วยให้คำแนะนำทีครับ  มันผิดพลาดอะไรยังไง
 
 
  Tag : PHP, HTML, CSS, HTML5               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2019-01-27 17:43:39 | 
                      By :
                          Gurionalone | 
                      View :
                          733 | 
                      Reply :
                          1 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  | 
	 
	
		
			  | 
		  | 
		
			  | 
		
			  | 
	 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
$sql = "INSERT INTO reservations (res_userid,res_equid ,res_status ,reservation_date) VALUES ('".$_POST['txtuserid']."','".$_POST['txtequid']."','".$_POST['txtstatus']."','".$_POST['txtdate']."')";
$query = mysqli_query($connect,$sql) or die ($sql);
if($query == TRUE){
	$sql2 = "INSERT INTO area_reservations (area_equid ,area_userid) VALUES ('".$_POST['txtequid']."','".$_POST['txtuserid']."')";
	$query2 = mysqli_query($connect,$sql2) or die ($sql2);
	if ($query2) {
	header("Location:  $Group ");
	}
}
mysqli_close($connect);
 
 
1.เช็ค เออเรอผิด ไปเช้คคอนเน็คแทนซะงั้น 
2.ลองเพิ่ม if เข้าไปในกรณีที่ เป็นจริง                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-01-28 08:45:49 | 
                        By :
                            nobetaking | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |