Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,027

HOME > PHP > PHP Forum > ช่วยดูโค้ดหน่อยคะว่าผิดตรงไหน งงไปหมดแล้ว มัน error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near at line 1



 

ช่วยดูโค้ดหน่อยคะว่าผิดตรงไหน งงไปหมดแล้ว มัน error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near at line 1

 



Topic : 086751



โพสกระทู้ ( 104 )
บทความ ( 0 )



สถานะออฟไลน์




useredit (PHP)
<?php 
$id = $_GET['user_id'];
$user_id=$_GET['user_id'];  
$major=$_POST['maname'];  
$name=$_POST['name']; 
$surname=$_POST['surname'];  
$education=$_POST['education'];
$campus=$_POST['campus'];  
$moblie=$_POST['moblie'];  
$email=$_POST['email'];
$status=$_POST['status'];
$department=$_POST['department'];

	$id = $_GET["id"];
    $sql = "SELECT `user`.*,`major`.maname
			FROM `user` INNER  JOIN `major` ON `user`.major_id=`major`.major_id 
			where user_id='$id'";//ไม่ต้องเเปลี่ยน
	$result = mysql_query($sql);
	$array = mysql_fetch_array($result);
	?>
&nbsp;</p>
        <div align="center">
          <form id="form1" name="form1" method="post" action="usereditsave.php">
            <p>;&nbsp;</p>
            <table width="337" border="0">
              <tr>
                <td colspan="2">&nbsp;</td>
              </tr>
              <tr>
                <td width="93">รหัสนักศึกษา</td>
                <td width="234"><label for="user_id"></label>
                <input name="user_id" type="text" id="user_id" value="<?=$array['user_id'];?>" /></td>
              </tr>
              <tr>
                <td>ชื่อ</td>
                <td><label for="name"></label>
                <input type="text" name="name" id="name" value="<?=$array['name'];?>"/></td>
              </tr>
              <tr>
                <td>นามสกุล</td>
                <td><label for="surname"></label>
                <input type="text" name="surname" id="surname" value="<?=$array['surname'];?>" /></td>
              </tr>
              <tr>
                <td>สาขา</td>
                
                <td><label for="major"></label>
                  <select name="major" id="major" >
                <option value="0"><-- Please Select Item --></option>            
<?            
$strSQL = "SELECT * FROM major ORDER BY major_id ASC";           
$objQuery = mysql_query($strSQL);            
while($objResuut = mysql_fetch_array($objQuery))            
{  if($strDefault == $objResuut["major_id"])              
		{                     
			$sel = "selected";                
		}              
	else               
		{                   
			$sel = "";                
		} 
  ?>             
<option value="<?=$objResuut["major_id"];?>" <?=$sel;?>> <?= $objResuut['maname'];?></option>           
<?             
}             
?>           
</select> 
               <label for=""></label></td>
              </tr>
              <tr>
                <td>ระดับการศึกษา</td>
                <td><label for="education"></label>
                  <select name="education" id="education">
                    <option value = "1" <?php if($array['education']==1){echo"selected";} ?> > ปริญญาตรี</option>
                    <option value = "2" <?php if($array['education']==2){echo"selected";} ?> > ปริญญาโท</option>
                    <option value = "3" <?php if($array['education']==3){echo"selected";} ?> > ปริญญาเอก</option>
                </select></td>
              </tr>
              <tr>
                <td>แผนก</td>
                <td><label for="department"></label>
                <input type="text" name="department" id="department" value="<?=$array['department'];?>" /></td>
              </tr>
              <tr>
                <td>วิทยาเขต</td>
                <td><label for="campus"></label>
                <input type="text" name="campus" id="campus" value="<?=$array['campus'];?>"/></td>
              </tr>
              <tr>
                <td>เบอร์โทร</td>
                <td><label for="moblie"></label>
                <input type="text" name="moblie" id="moblie" value="<?=$array['moblie'];?>" /></td>
              </tr>
              <tr>
                <td>E-mail</td>
                <td><label for="email"></label>
                <input type="text" name="email" id="email"value="<?=$array['email'];?>" /></td>
              </tr>
              <tr>
                <td>สถานะ</td>
                <td><label for="status"></label>
                  <select name="status" id="status" >
                    <option value== "1" <?php if($array['status']==1){echo"selected";} ?> > Admin </option>
                    <option value="2"<?php if($array['status']==2){echo"selected";} ?> > User</option>
                    <option value="3"<?php if($array['status']==3){echo"selected";} ?> >>VIP</option>
                </select>                  <label for="textfield10"></label></td>
              </tr>
              <tr>
                <td colspan="2"><div align="center">
                  <input type="submit" name="button" id="button" value="ยืนยัน" />




Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2012-11-15 09:12:45 By : ผู้หญิงสีดำ View : 745 Reply : 1
 

 

No. 1



โพสกระทู้ ( 104 )
บทความ ( 0 )



สถานะออฟไลน์


edituserco(PHP)
<?php include('.../include/config.php');
@session_start();
?>
<!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>
</head>

<body>
</body>
</html>
<?php
$user_id=$_POST['user_id'];  
$major=$_POST['maname'];  
$name=$_POST['name']; 
$surname=$_POST['surname'];  
$education=$_POST['education'];
$campus=$_POST['campus'];  
$moblie=$_POST['moblie'];  
$email=$_POST['email'];
$status=$_POST['status'];
$department=$_POST['department'];

$sql="update user set user_id=$user_id,maname=$major,name=$name,surname=$surname,education=$education,campus=$campus,department=$department,moblie=$moblie,email=$email,status=$status WHERE user_id='$user_id'"; 
$dbquery = mysql_query($sql) or die (mysql_error()); 
echo $dbquery;
if($dbquery)         
{  
?>       
<script> 
alert("แก้ไขข้อมูลสำเร็จ"); 
window.location="asset.php";       
</script> 
<?          
}    
else    
{         
?>       
<script> 
alert("การแก้ไขข้อมูลเกิดข้อผิดพลาด"); 
window.location="editasset.php";          
</script>                 
<?     
} 
?>








แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2012-11-15 09:13:27 By : ผู้หญิงสีดำ
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ช่วยดูโค้ดหน่อยคะว่าผิดตรงไหน งงไปหมดแล้ว มัน error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near at line 1
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

Load balance : Server 05
ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2024 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่