  | 
              
	              
	                
  
    
	 
        ทำไมมันไม่ยอม insert ข้อมูลลงฐานข้อมูลอ่ะครับ ทำไมมันไม่ยอมinsertข้อมูลลงอ่ะครับตอน if แรก     | 
   
  
    |   | 
   
 
 
 
	
		
			  | 
	   | 
	    | 
		
			  | 
	 
	
		
			  | 
		 		   | 
	  	    
          
            
			
	
			
			 
                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>Untitled Document</title>
<html>
<head>
<title>ThaiCreate.Com PHP & MySQL Tutorial</title>
</head>
<body>
<?
 $objConnect = mysql_connect("localhost","soapkub_soapkub","soaptaii") or die("Error Connect to Database");
$objDB = mysql_select_db("soapkub_bag");
    
    mysql_query( "SET NAMES UTF8" ) ;  
if($verify_status<1){
  $objConnect = mysql_connect("localhost","soapkub_soapkub","soaptaii") or die("Error Connect to Database");
$objDB = mysql_select_db("soapkub_bag");
    mysql_query( "SET NAMES UTF8" ) ;  
     $text = "ABCDEFGHIJKLMNPQRSTUVWXYZ123456789";
      $verify_code = substr(str_shuffle($text),0,10);   
      $strSQL = "INSERT INTO customer VALUES ('$verify_code')"; 
        $strSQL = "";
	$strSQL = "INSERT INTO customer ";
	$strSQL .="(email) ";
	$strSQL .="VALUES ";
         $strSQL .="('".$_POST["email"]."' ) ";
         
    $strTo = "[email protected]" ; 
    $strSubject = "Verify By Email" ; 
    $strHeader = "Content-type: text/html; charset=UTF-8\n"; // or UTF-8 //
    $strHeader .= "From: Admin <[email protected]>\nReply-To: [email protected]";
    $strVar = "My Message";
    $strMessage = "<a href=http://www.stevemaddenhandbags.info/verify_by_email.php?
                     verify_code={$member_verify_code}&email={".$_POST["email"]."}>
                     คลิกเพื่อยันยัน</a>" ; 
    
    $flgSend = @mail($strTo,$strSubject,$strMessage,$strHeader);  // @ = No Show Error //
	if($flgSend)
	{
		echo "Email Sending.";
	}
	else
	{
		echo "Email Can Not Send.";
	}
mysql_close($objConnect);
}else{     
  $objConnect = mysql_connect("localhost","soapkub_soapkub","soaptaii") or die("Error Connect to Database");
$objDB = mysql_select_db("soapkub_bag");
$strSQL = "SELECT * FROM customer WHERE email = '".$_POST["email"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if($objResult)
{
		echo "<script>alert('มีข้อมูลอยู่ในระบบแล้วครับ');</script>";
			echo "<script>window.location='index.php';</script>";
			exit();
}
else
{
$strSQL = "INSERT INTO customer VALUES ('$dates')";
	$strSQL = "";
	$strSQL = "INSERT INTO customer ";
	$strSQL .="(email,webcam,sex,name,age,country2,province2) ";
	$strSQL .="VALUES ";
	$strSQL .="('".$_POST["email"]."','".$_POST["webcam"]."','".$_POST["sex"]."' ,'".$_POST["name"]."' ";
	$strSQL .=",'".$_POST["age"]."','".$_POST["country2"]."','".$_POST["province2"]."') ";
	$objQuery = mysql_query($strSQL);
	if($objQuery)
	{
		echo "<script>alert('ดำเนินการเรียบร้อยแล้วครับ');window.location='index.php';</script>";
			exit();
	}
	else
	{
		echo "Error Save [".$strSQL."]";
	}
	}
mysql_close($objConnect);
}?>
</body>
</html>
 
ทำไมมันไม่ยอมinsertข้อมูลลงอ่ะครับตอน if แรก
 
 
  Tag : PHP, MySQL               
                        | 
           
          
            | 
			
                             | 
           
          
            
              
                   | 
                   | 
                   | 
               
              
                   | 
                
                    
                      | Date :
                          2011-01-21 20:45:53 | 
                      By :
                          ช่วยด้วยครับ | 
                      View :
                          784 | 
                      Reply :
                          4 | 
                     
                  | 
                   | 
               
              
                   | 
                   | 
                   | 
               
              | 
           
          
            | 
			 | 
           
         
	    
		             | 
		
			  | 
	 
	
		
			  | 
		  | 
		
			  | 
		
			  | 
	 
 
              
  
          
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
$objQuery = mysql_query($strSQL) or die(mysql_error());
  
 
ก็จะรู้ว่า error เพราะอะไรครับ                        
               
               | 
             
            
              
			  			  
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-01-21 22:21:46 | 
                        By :
                            webmaster | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 พอใส่แล้วมันเกบอีเมลล์ลงครับแต่มันไม่ยอมเกบค่า verify_code อ่ะครับ                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-01-21 22:43:42 | 
                        By :
                            ช่วยด้วยครับ | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 "พอใส่แล้วมันเกบอีเมลล์ลงครับแต่มันไม่ยอมเกบค่า verify_code อ่ะครับ" 
 
หมายถึงบรรทัดที่ 24  นี้รึเปล่าครับ 
Code (PHP) 
$strSQL = "INSERT INTO customer VALUES ('$verify_code')"; 
 
 
เห็นมีแต่ตัวแปร ไม่มีการคิวรี่เพื่อจัดเก้บเลยนี่ครับ 
>>> mysql_query($strSQL);                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-01-22 00:20:12 | 
                        By :
                            Naizan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 น่าจะสร้าง function ไว้เช็คต่างหากนะครับ เผื่อจะได้ง่ายเวลาเรียกใช้                        
               
               | 
             
            
              
			                              
                              
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-01-22 01:44:27 | 
                        By :
                            Yaizenx | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     | 
   
 
                 |