  | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ขอดูโค้ดหน่อยครับแบบนี้มันคงตอบลำบากอ่ะครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-09-21 22:18:43 | 
                        By :
                            somparn | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ดูใน phpmyadmin ว่ามีข้อมูลหรือยัง ถ้ายังแสดงว่าบันทึกไม่ได้ ให้ลอง echo sql statement ออกมาดู 
 
ถ้าเกิดใน phpmyadmin มีข้อมูลแสดงว่า query ผิดหรือใช้ตัวแปลผิดอะไรสักอย่าง                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-09-21 22:20:40 | 
                        By :
                            plakrim | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ไม่มันแสดง error อารายเลยค่ะ 
 
 นี้โค้ดไฟล์ add.php 
 
Code (PHP) 
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
 <?php
 include("chk_loginpass.php");  
 if ($save=="ตกลง"){
 
$name=$_POST[name];
$province=$_POST[province];
$fileupload=$_FILES['fileupload']['tmp_name'];
$fileupload_name=$_FILES['fileupload']['name'];
$fileupload_size=$_FILES['fileupload']['size'];
$fileupload_type=$_FILES['fileupload']['type'];
$types=$_POST[types];
$suggest=$_POST[suggest];
if ($name=="") {
	echo "<H3> ERROR : กรุณากรอก ชื่อ </H3>";
	exit;
}
if ($province=="0") {
	echo "<H3> ERROR : กรุณาเลือก จังหวัด </H3>";
	exit;
}
include "connect.php";
$sql="insert into tb_search";
$result=mysql_db_query($dbname,$sql);
if ($fileupload) {
	$array_last=explode(".",$fileupload_name);
	$c=count($array_last)-1; 
	$lastname=strtolower($array_last[$c]) ;
	
	if ($lastname=="gif" or $lastname=="jpg" or $lastname=="jpeg") {
         $sql2="select max(id) from tb_search  ";
		$result2=mysql_db_query($dbname,$sql2)  or trigger_error(mysql_error(),E_USER_ERROR); 
		$row=mysql_fetch_row($result2);
       $photoname=$row[0].".".$lastname;
       copy($fileupload,"photo/".$photoname);
        $sql3="update tb_search  set photo='$photoname' where id ='$row[0]' ";
		$result3=mysql_db_query($dbname,$sql3)  or trigger_error(mysql_error(),E_USER_ERROR); 
      	} 
	unlink($fileupload);
} 
echo "<H3> บันทึกข้อมูลเรียบร้อยแล้ว </H3>";
echo "<A HREF='index.php'> กลับไปหน้าแรก</A> ";
 }
 ?>
<BODY>
<b>เพิ่มข้อมูลสถานที่ท่องเที่ยว</b>
<FORM METHOD="POST" ACTION="add.php"   ENCTYPE="multipart/form-data">
<TABLE>
<TR>
	<TD>ชื่อ : </TD>
	<TD><INPUT TYPE="text" NAME="name" SIZE="25"> *</TD>
</TR>
<TR>
	<TD>จังหวัด  : </TD>
	<TD>
		<SELECT NAME="province">
		<OPTION VALUE='0'> ----- เลือก ----- </OPTION>
		<?
		include "provincelist.php";
		for ($i=1;$i<=count($p);$i++) {
			echo "<OPTION VALUE='$i'> $p[$i] </OPTION>";
		}
		?>
		</SELECT> *	</TD>
</TR>
<TR>
	<TD>รูปภาพ : </TD>
	<TD>	
		<INPUT TYPE="file" NAME="fileupload">
		<input type="hidden" name="MAX_FILE_SIZE" value="100000"></TD>
</TR>
<TR>
	<TD>ประเภท : </TD>
	<TD><label>
	  	      <SELECT NAME="types">
	        <OPTION VALUE="ประวัติศาสตร์">ประวัติศาสตร์</OPTION>
	        <OPTION VALUE="ธรรมชาติ">ธรรมชาติ </OPTION>
	        <OPTION VALUE="อื่นๆ">อื่นๆ</OPTION>
			</SELECT>  
	</label></TD>
</TR>
<TR>
	<TD>รายละเอียด : </TD>
	<TD><TEXTAREA NAME="suggest" ROWS="3" COLS="40"></TEXTAREA></TD>
</TR>
<TR>
	<TD> </TD>
	<TD>
		<INPUT TYPE="submit" VALUE="ตกลง"  name="save">
		<INPUT TYPE="reset" VALUE="ยกเลิก">	</TD>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
 
 
อันนี้ไฟล์ที่เชื่อมต่อจากไฟล์ add.php 
 
  ไฟล์ chk_loginpass.php  
 
Code (PHP) 
<?php 
@session_start();
if($_SESSION["loginpass"] ==null )  {
print "No login";
   exit () ;
 }
?>
                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-09-21 22:38:33 | 
                        By :
                            anny110 | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	     
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ขอบคุณมากค่ะ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-09-22 20:59:39 | 
                        By :
                            ann | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ช่วยดูให้ผมอีกคนด้วยนะ 
 
Code (PHP) 
<?php 
$txt_title=$_POST['txt_title'];
$txt_detail=$_POST['txt_detail'];
$txt_update=$_POST['txt_update'];
$attach_file=$_FILES['attach_file']['tmp_name'];
$attach_file_name=$_FILES['attach_file']['name'];
$attach_file_size=$_FILES['attach_file']['size'];
$attach_file_type=$_FILES['attach_file']['type'];
if(!$txt_title || !$txt_detail) {
	echo"กรุณา : กรอกหัวข้อข่าวและรายละเอียดข่าวด้วยครับ";
	}else{
	include"connectdb.php";
	
	$array_last=explode(".",$attach_file_name);
	$c=count($array_last)-1;
	$lastname=strtolower($array_last[$c]);
	if($lastname!="doc" and $lastname!="docx"  and $lastname!="ppt"  and $lastname!="pptx"  and $lastname!="jpg" and $lastname!="jpeg" and $lastname!="pdf"){
		echo"ERROR : อัพโหลดได้เฉพาะไฟล์นามสกุลดังนี้  *.doc ,*.docx,*.ppt,*.pptx,*.pdf,*.jpg, *.jpeg ครับ";
		}else{
		copy($attach_file,"news_data/".$attach_file_name);
		$sql="insert into pr_news values('','$txt_title','$txt_detail','$attach_file','$txt_update')";
		mysql_db_query($dbname,$sql);
		
		echo "<meta http-equiv='refresh' content='0 ;url=news_all.php'>" ; 
		}
		//unlink($attach_file);
		mysql_close();
		}
?>
 
บรรทัดนี้ copy($attach_file,"news_data/".$attach_file_name); ไฟล์ก็ถูกกอปปี้ไปแล้ว 
 
แต่บรรทัดนี้ $sql="insert into pr_news values('','$txt_title','$txt_detail','$attach_file','$txt_update')"; ดันไม่เพิ่มลงฐานข้อมูลให้อ่ะครับ 
 
ช่วยด้วยน้า........                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-10-08 10:28:27 | 
                        By :
                            อาร์ท | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 $sql="insert into pr_news values('','$txt_title','$txt_detail','$attach_file','$txt_update')"; 
 
ลองเปลี่ยนเป็น 
 
echo $sql="insert into pr_news values('','$txt_title','$txt_detail','$attach_file','$txt_update')";exit(); 
 
แล้วเอา $sql ที่แสดงออกมาไปใส่ใน phpmyadmin ดูครับ 
 
 
แนะนำเพิ่มอีกนิดครับ 
 
น่าจะทำ step แบบนี้ครับ 
 
Code (PHP) 
$sql="bla bla bla";
$result=mysql_query($sql); หรือจะ $result=mysql_query($dbname,$sql); ตามใจชอบ
if($result)
{
  copy("bla bla bla");
}
else
{
  echo "Error!!! bla bla bla";
}
 
 
ถ้า $sql เรามีปัญหามันจะได้ไม่ copy ไฟล์ที่เราแนบครับ และควรทำการ random ชื่อไฟล์ครับ 
 
เดี๋ยวจะมีปัญหาตอนที่เอาไฟล์ที่มีชื่อและนามสกุลเดียวกัน up เข้าไปอีก จะวุ่นวายครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-10-08 16:09:34 | 
                        By :
                            suriya_puk | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 มันขึ้นมาแบบนี้เลยอ่ะครับ 
 
insert into pr_news values('','ทดสอบ','ทดสอบการเพิ่มข่าว','C:\WINDOWS\TEMP\php22.tmp','อาร์ท') 
 
แล้วก็ยังไม่เพิ่มลงในฐานข้อมูลด้วยอ่ะ 
 
ช่วยด้วยนะ......                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-10-14 09:17:55 | 
                        By :
                            อาท | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ก่อนอื่น แนะนำให้ อาร์ท มาเป็นสมาชิก ThaiCreate กับพวกเราอ่ะครับ อยากมีเพื่อนๆ ในบอร์ดที่เป็นสมาชิกเยอะๆ  
 
ส่วน Code อ่ะที่ให้มาหมดแล้วใช้ไหม Code ในการ add ข้่อมูลน่ะครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-10-14 09:42:21 | 
                        By :
                            pokultra | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ช่ายแล้วครับ 
 
ตอนนี้ผมได้ปรับเพื่อไม่ให้มีการ copy ไฟล์ถ้ายังไม่ได้เพิ่มลง DB ซึ่งก็ได้โค้ดอย่างนี้นะครับ 
 
Code (PHP) 
<?php 
$txt_title=$_POST['txt_title'];
$txt_detail=$_POST['txt_detail'];
$txt_update=$_POST['txt_update'];
$attach_file=$_FILES['attach_file']['tmp_name'];
$attach_file_name=$_FILES['attach_file']['name'];
$attach_file_size=$_FILES['attach_file']['size'];
$attach_file_type=$_FILES['attach_file']['type'];
if(!$txt_title || !$txt_detail) {
	echo"กรุณา : กรอกหัวข้อข่าวและรายละเอียดข่าวด้วยครับ";
	}else{
	include"connectdb.php";
	
	$array_last=explode(".",$attach_file_name);
	$c=count($array_last)-1;
	$lastname=strtolower($array_last[$c]);
	
	if($lastname!="doc" and $lastname!="docx"  and $lastname!="ppt"  and $lastname!="pptx"  and $lastname!="jpg" and $lastname!="jpeg" and $lastname!="pdf"){
	echo"ERROR : อัพโหลดได้เฉพาะไฟล์นามสกุลดังนี้  *.doc ,*.docx,*.ppt,*.pptx,*.pdf,*.jpg, *.jpeg ครับ";
	}else{
	$sql="insert into pr_news values('','$txt_title','$txt_detail','$attach_file','$txt_update')";
	$result=mysql_query($dbname,$sql);
	if($result){
		copy($attach_file,"news_data/".$attach_file_name);
		}
		else{			
		echo "Sql ผิดพลาดจึงไม่สามารถ กอปปี้ไฟล์นี้ได้ครับ";
		}
		mysql_close();
							
		}
		}
		?>
 
 
 
แต่ก็ยังเออเรอร์ว่า:: 
 
Code 
Warning: mysql_query(): supplied argument is not a valid MySQL-Link resource in d:\appserv\www\web53\news_add.php on line 32 
Sql ผิดพลาดจึงไม่สามารถ กอปปี้ไฟล์นี้ได้ครับ   
 
ช่วยด้วยครับ เด่วผมจะสมัครเป็นสมาชิกละครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-10-14 10:04:00 | 
                        By :
                            อาร์ท | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 line 32 คือ $result=mysql_query($dbname,$sql);                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2009-10-14 10:06:29 | 
                        By :
                            อาร์ท | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 มันไม่เพิ่มเข้าไปฐานข้อมูลเหมือนกันค่ะ  พอลองกรอกข้อมูลแล้ว มันก็จะขึ้นว่า ระบบขัดข้อง  ค่ะ   (ไฟล์ add.php ) 
 
Code (PHP) 
<?php
$host = "127.0.0.1";
$user ="root";
$passwd = "....";
$dbname = "projact";
mysql_connect($host,$user,$passwd) or die("ติดต่อ Host ไม่ได้");
mysql_select_db($dbname) or die ("ติดต่อฐานข้อมูลไม่ได้");
$sql = "insert into 'uereinfo'  ('name' , 'last' , 'pass' , 'confirmpass' , 'birthday' , 'email' , 'address' , 'gender')
            values ('$name ' , '$last' ,'$pass' , '$confirmpass' , '$birthday' , '$email' , '$address' , '$gender')";
mysql_query("set NAMES tis620");
$sqlquery=mysql_db_query($dbname,$sql);
$checkadd="select * from `userinfo` where email='$email' ";
$result = mysql_db_query ($dbname,$checkadd);
$num=mysql_num_rows($result);
				if($num==1)
				{
					echo"<br>ข้อมูลได้จัดเก็บแล้ว  ให้แสดงหน้าsingup";
				}
				else if  ($num>=1)
							{
								echo"<br>emailนี้มีอยู่แล้ว";
							}
				 else
				       {
						   echo"ระบบขัดข้อง หรือ มีข้อผิดพลาด";
					   }
mysql_close();
?>
                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-09-19 22:27:20 | 
                        By :
                            momay | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 อยากให้ช่วยดูให้ผมหน่อยคับคือแบบว่าบันทึกข้อมูลลงไปข้อมูลก้ลงถานข้อมูลนะคับแต่มันบอกว่าไม่สามารถบันทึกได้อะคับ 
อยากให้ช่วยด่วนเลยคับ 
นี่คือโคดนะคับ 
 
Code (PHP) 
<?
    session_start();
   	if(!$_SESSION["login"])
	{
	header("content-type: text/html; charset=utf-8");	
	echo("<script>alert('ผิดพลาด! คุณยังไม่ได้ทำการลงชื่อเข้าสู่ระบบ'); window.location='index.php';</script>");
	exit();
	
	}
header("content-type: text/html; charset=utf-8");
include	("../config/config.php");
include	("../function/function.php");
/*$score_score=$_POST['score_score'];
$score_s=$_POST['score_s'];
$num=100;
echo "<br>".$score_score;
echo "<br>".$score_s;
echo "="."<br>".$score_all=(($score_score*$num)/$score_s);*/
 $sql=insert("id,name,surname,rankname,level,header,sur_header,hrank,roundper,score_all,year_code",
"'$_POST[id]','$_POST[name]','$_POST[surname]','$_POST[rankname]', '$_POST[level]','$_POST[header]','$_POST[sur_header]','$_POST[hrank]' ,'$_POST[roundper]','$score_all','$year_code'","perform");
    $sql_edit="update person set roundper ='1' where name='$_SESSION[ss_person_code]'";
	$result=mysql_db_query($dbname,$sql_edit);
	if(mysql_db_query($dbname,$sql_edit))
		{
		}
	
	
		
if($sql){
    echo "<script>alert('บันทึกเรียบร้อยแล้วครับ');window.history.back();</script>";
	exit();
}else {
    echo "<script>alert('ไม่สามารถบันทึกได้ครับ');window.history.back();</script>";
	
	
	exit();
}
?>
<?
if($_POST['saveform']){
echo 	$sql_edit="update person set roundper ='1' where name='$_SESSION[ss_person_code]'";
	$result=mysql_db_query($dbname,$sql_edit);
	if(mysql_db_query($dbname,$sql_edit))
		{
		}
	else 
		{
			echo "<br><BR>";
			echo "<script language='javascript'>alert(' ข้อมูลไม่ถูกต้อง ! '); history.back();</script> ";
		}
}
	else 
		{
			echo "<br><BR>";
			echo "<script language='javascript'>alert(' ข้อมูลไม่ถูกต้อง ! '); history.back();</script> ";
		}
?>
                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2011-10-03 01:02:48 | 
                        By :
                            supermade | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 รบกวนช่วยดูให้หนูหน่อยคะ ทำมาหลายวันแล้วก็ยังเพิ่มข้อมูลไม่ได้สักที ฝากด้วยคะ T_T 
 
 
Code (PHP) 
<? 
	session_start(); //เปิด session
	include("config.inc.php"); 
	
	
	
?>	 
 <? 
$Dg_Income = $_POST["Year"]."-".$_POST["Month"]."-".$_POST["Date"];
if(isset($_POST[submit])){
$sql = "INSERT INTO durable_goods VALUES('$_POST[Dg_idtxt]',$Dg_Income,'$_POST[Dg_nametxt]' ,'$POST[Dg_Brandtxt]','$_POST[Dg_Typetxt]','$_POST[Dg_colourtxt]', '$_POST[Dg_Sizetxt]','$_POST[PriceToUnittxt]','$_POST[Dg_budgettxt]','$_POST[Notetxt]')";
$result = mysql_query($sql) or die ("เพิ่มข้อมูลไม่ได้");	
echo "บันทึกข้อมูลเรียบร้อยแล้ว";
										
}
											
									
?>
                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2012-11-29 16:35:38 | 
                        By :
                            เด็กหญิงอ้วนกลม | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
<?
             $photo=$_FILES['photo']['tmp_name'];
             $photo_name=$_FILES['photo']['name'];
             $photo_size=$_FILES['photo']['size'];
             $photo_type=$_FILES['photo']['type'];
			 $member_id=$_POST['member_id'];
			 $member_pass=$_POST['member_pass'];
			 $member_PS=$_POST['member_PS'];
			 $member_name=$_POST['member_name'];
			 $member_lname=$_POST['member_lname'];
			 $member_fac=$_POST['member_fac'];
			 $member_major=$_POST['member_major'];
			 $member_email=$_POST['member_email'];
			 ;
			
			 
	include "../connect.php";
	$sql="insert into group_member values(
	member_id='$member_id',
	member_pass='$member_pass',
	member_PS='$member_PS',
	member_name='$member_name',
	member_lname='$member_lname',
	member_fac='$member_fac',
	member_major='$member_major',
	photo_name='$photo_name',
	member_email='$member_email',
    member_status='3'
	
	
	)";
	mysql_db_query($dbname,$sql);
	copy($photo,"../photo/$photo_name");
	echo "$sql";
	echo"<div align=center><font color=#003a65><b>เพิ่มข้อมูลเรียบร้อยแล้ว</b></font></div>";
	echo "<meta http-equiv='refresh' content='10 ;url=professor_s.php?member_id=$member_id'>" ;
			 
			 ?>
 
 
                         
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2015-02-21 22:59:20 | 
                        By :
                            ฝุ่น | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 เปิด file connect.php หา 
ตรง $ตัวแปรconection resource= mysql_connect(server, user, password); 
 
 
แล้วมาเปลี่ยน จาก 
mysql_db_query($dbname,$sql); 
เป็น 
mysql_db_query($ตัวแปรconection resource,$sql);                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2015-02-22 03:11:13 | 
                        By :
                            ผ่านมา | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ตอบคห. 15-16 
 
Code 
SQL Statement ผิด ไวยกรณ์นะครับ เอาสีแดงออกไป เพิ่มสีเขียว
$sql="insert into group_member values(  set
member_id='$member_id',
member_pass='$member_pass',
member_PS='$member_PS',
member_name='$member_name',
member_lname='$member_lname',
member_fac='$member_fac',
member_major='$member_major',
photo_name='$photo_name',
member_email='$member_email',
member_status='3'
)";
mysql_db_query($dbname,$sql);
 
  
 
คุณเอารูปแบบ values มาใช้ กับ set ครับ 
 
ถ้าใช้ values ต้องเขียนแบบนี้  insert into table ( field1, field2) values( var1, var2) 
ถ้าใช้ set ต้องเขียนแบบนี้ insert into table set field1=var1, field2=var2                        
               
               | 
             
            
              
			                
  ประวัติการแก้ไข 2015-02-22 09:51:49                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2015-02-22 09:51:03 | 
                        By :
                            Chaidhanan | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 ช่วยด้วยค่ะ รันได้ปกติแต่  ข้อมูลไม่ลงฐานข้อมูล 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>Untitled Document</title> 
<style type="text/css"> 
#form1 p { 
	text-align: center; 
} 
body,td,th { 
	color: #000; 
} 
body { 
	background-color: #CFF; 
} 
</style> 
</head> 
 
<body> 
<?php 
include ('inset.php'); 
if($_post[button]=="sudmit"){ 
	 
       
      $taxt_name_surname = $_post[txt_name_surname]; 
      $taxt_e_mail = $_post[txt_e_mail]; 
      $taxt_password = $_post[txt_password]; 
      $taxt_confirmpassword = $_post[txt_confirmpassword]; 
 
} 
$query = "insert into  tbl_register(name_surname,e_mail,password,confirmpassword) values ($'txt_name_surname',$'txt_e_mail',$'txt_pass')"; 
$result = mysql_db_query ($dbname,$guery); 
if($result){ 
  echo "ok......"; 
} 
else{ 
   echo "Error....."; 
} 
?>                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2016-03-01 14:49:37 | 
                        By :
                            วนิษา สุจริต | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 เพิ่มลงดาต้าเบสไม่ได้ เพิ่มได้แค่ row เดียว ทำอย่างไรดี                         
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-04-29 00:04:09 | 
                        By :
                            Josh | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 สมัครสมาชิก แล้วตั้งคำถามใหม่                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-04-30 14:11:45 | 
                        By :
                            apisitp | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 Code (PHP) 
$query = "insert into tbl_register(name_surname,e_mail,password,confirmpassword) values ($'txt_name_surname',$'txt_e_mail',$'txt_pass')";
  
 
ใส่ ' ผิดนะครับ                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2018-04-30 17:07:21 | 
                        By :
                            ดินทราย | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
               
		
     
		
	  
        
             | 
            | 
            | 
             | 
         
        
             | 
                       | 
          
            
               
                 รบกวนช่วยดูของผมด้วยครับ (มันไม่เพิ่มข้อมูลในฐานข้อมูลให้ เช็ดหลายรอบแล้วหาไม่เจอเลยขอบคุณครับ) 
<?php 
 
    session_start(); 
 
    require_once "connect.php"; 
 
    if (!isset($_SESSION['username'])) { 
        header('location: login.php'); 
    }  
 
    if (isset($_POST['submit'])) { 
 
        $post_title = $_POST['title']; 
        $post_author = $_POST['author']; 
        $post_keywords = $_POST['keywords']; 
        $post_content = $_POST['content']; 
        $post_image = $_FILES['image']['name']; 
        $image_tmp = $_FILES['image']['tmp_name']; 
     
        move_uploaded_file($image_tmp, "../img/$post_image"); 
 
        $insert_query = "INSERT INTO posts (post_title, post_date, post_author, post_image, post_keywords, post_content) 
                        VALUES ('$post_title', '$post_author', '$post_image', '$post_keywords', '$post_content')"; 
 
        if (mysqli_query($conn, $insert_query)) { 
            echo "<script>alert('Post published seccessfully');</script>"; 
        } else { 
            echo "<script>alert('Something wrong!');</script>"; 
        } 
    } 
?> 
 
<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="UTF-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <meta http-equiv="X-UA-Compatible" content="ie=edge"> 
    <link rel="stylesheet" href="css/adminstyle.css"> 
    <title>Insert Post</title> 
</head> 
<body> 
    <header> 
        <div class="container"> 
            <h1> 
                WELCOME TO ADMIN PANG MR.  
            </h1> 
        </div> 
    </header> 
 
    <section class="content"> 
        <div class="content_grid"> 
 
            <div class="sidebar"> 
                <h1>WELCOME :</h1> 
                <h3><a href="index.php">Home</a></h3> 
                <h3><a href="view_posts.php">View Posts</a></h3> 
                <h3><a href="insert_post.php">Insert Post</a></h3> 
                <h3><a href="logout.php">Log out</a></h3> 
            </div> 
 
            <div class="showinfo "> 
                <h1>View All Post</h1> 
 
                <form action="insert_post.php" method="post" enctype="multipart/form-data"> 
 
                    <table width="100%" align="center" border="1"> 
 
                        <tr> 
                            <td align="center" colspan="6"><h1>Insert New Post</h1></td> 
                        </tr> 
 
                        <tr> 
                            <td>Post Title</td> 
                            <td><input type="text" name="title" size="50"></td> 
                        </tr> 
                         
                        <tr> 
                            <td>Post Author</td> 
                            <td><input type="text" name="author" size="50"></td> 
                        </tr> 
 
                        <tr> 
                            <td>Post Keywords</td> 
                            <td><input type="text" name="keywords" size="50"></td> 
                        </tr> 
 
                        <tr> 
                            <td>Post Image</td>         
                            <td><input type="file" name="image" size="50"></td> 
                        </tr> 
 
                        <tr> 
                            <td>Post Content</td> 
                            <td><textarea  name="content" cols="50" rows="15"> </textarea></td> 
                        </tr> 
 
                        <tr> 
                            <td align="center" colspan="5"><input type="submit" name="submit" value="Publish Now" ></td> 
                        </tr> 
 
                    </table> 
 
                </form>  
 
            </div> 
             
        </div> 
    </section> 
</body> 
</html>                        
               
               | 
             
            
              
			                                
              
                
                     | 
                     | 
                     | 
                 
                
                     | 
                  
                      
                        | Date :
                            2019-09-29 15:42:44 | 
                        By :
                            too | 
                         
                    | 
                     | 
                 
                
                     | 
                     | 
                     | 
                 
                | 
             
           
			         | 
             | 
         
        
             | 
            | 
             | 
             | 
         
          
	    
     
      		  
	
     |