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 > รบกวนพี่ๆช่วยดูให้หน่อยค่ะ...น้องสงสัยอย่างแรง เป็นโค้ดแก้ไขข้อมูลสมาชิกอะค่ะ ตอนแก้ไขข้อมูลแล้วสามารถแก้ไขได้



 

รบกวนพี่ๆช่วยดูให้หน่อยค่ะ...น้องสงสัยอย่างแรง เป็นโค้ดแก้ไขข้อมูลสมาชิกอะค่ะ ตอนแก้ไขข้อมูลแล้วสามารถแก้ไขได้

 



Topic : 037611



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



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




เป็นโค้ดแก้ไขข้อมูลสมาชิกอะค่ะ
ตอนแก้ไขข้อมูลแล้วสามารถแก้ไขได้
แล้วขึ้นว่าแก้ไขได้เรียบร้อย
แต่ทำไมค่ะสงสัยในฐานข้อมูลมันไม่เปลี่ยนค่ะ
สงสัยมากเลยว่าติดตรงไหน
ขอบคุณมากๆๆๆ
ติดต่อฐานข้อมุล
connecdb.php
<?php

$host = "localhost";
$username = "root";
$password ="123";
$dbname = "dbwbi";

mysql_connect($host,$username,$password)or die("ไม่สามารถติดต่อ my sql ได้");;
mysql_select_db("$dbname")or die("ไม่สามารถติดต่อฐานข้อมูลได้");
$CharSet = "SET NAMES 'tis620'";
mysql_query($CharSet);

mysql_query("set character set tis620");
mysql_query("set collation_connection = 'tis620'"); 
mysql_query("set names tis620");


?>

หน้าฟอร์มค่ะ
frmedit.php
<form id="form1" name="form1" method="post" action="edituser_save.php?id=<?=$_GET["id"];?>">
		 		  <table width="98%" height="298" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <th width="32%" scope="row"><div align="left">user(ชื่อผู้เข้าใช้):</div></th>
          <td width="68%"><label>
          <input type="text" name="txtusername" size=30 maxlength=12  value="<? echo $_SESSION['txtusername']; ?>" > 
            <input type="button" name="btchuser" value="ตรวจสอบชื่อผู้ใช้" />
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">password:</div></th>
          <td><label>
            <input type="password" name="txtpassworda"  value="<? echo $_SESSION['pass']; ?>" />
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">ยืนยัน password:</div></th>
          <td><input type="password" name="txtconpassword" value="" <? echo $_SESSION['pass']; ?>" />
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">ชื่อ:</div></th>
          <td><label>
            <input type="text" name="txtname" value="<? echo $_SESSION['name']; ?>"/>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">นามสกุล:</div></th>
          <td><label>
            <input type="text" name="txtlastname" value="<? echo $_SESSION['sname']; ?>"/>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">เพศ:</div></th>
          <td><label>
           <input name="rdsex1" type="radio" value="1" <? if ($_SESSION['sex']==1) {echo 'checked';}?>/>
          ชาย 
          <input name="rdex2" type="radio" value="2" <? if ($_SESSION['sex']==2) {echo 'checked';}?>/>
          หญิง</label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">อายุ:</div></th>
          <td><label>
            <select name="selectage">
              <option value="0">เลือกอายุ</option>
              <option value="1" <? if ($_SESSION['age']==1) {echo 'selected';}?>>อายุ10-12ปี</option>
              <option value="2" <? if ($_SESSION['age']==2) {echo 'selected';}?>>อายุมากกว่า 13 ปี</option>
            </select>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">การศึกษา:</div></th>
          <td><label>
            <input name="rdstudy1" type="radio" value="1"  <? if ($_SESSION['study']==1) {echo 'checked';} ?>/>
          ผู้เรียนชั้นประถมศึกษาปี่ที่ 5 
          <input name="rdstudy2" type="radio" value="2"  <? if ($_SESSION['study']==2) {echo 'checked';}?>/>
          ผู้เรียนทั่วไป
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">E-mail:</div></th>
          <td><label>
            <input type="text" name="txtemail" maxlength='50' value="<? echo $_SESSION['email']; ?>"/>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">คำถามกันลืม:</div></th>
          <td><label>
            <select name="select">
              <option value="0">เลือกคำถามที่ต้องการ</option>
              <option value="1"<? if ($_SESSION['ques']==1) {echo 'selected';}?>>ชื่อเล่น</option>
              <option value="2" <? if ($_SESSION['ques']==2) {echo 'selected';}?>>สีที่ชอบ</option>
              <option value="3" <? if ($_SESSION['ques']==3) {echo 'selected';}?>>สัตว์เลี้ยงที่ชอบ</option>
            </select>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">คำตอบ:</div></th>
          <td><label>
            <input type="text" name="txtans" value="<? echo $_SESSION['ans']; ?>"/>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td><label>
            <input type="submit" name="btsubmit" value="ตกลง" />
            <input type="reset" name="btcancle" value="ยกเลิก" />
          </label></td>
        </tr>
      </table>
          </form>

หน้าประมวลผลค่ะ
save_edituser.php
<?
include ("connectdb.php");
$strSQL = "UPDATE tbluser  SET ";
$strSQL .="username = '".$_POST["txtusername"]."' ";
$strSQL .=",password = '".$_POST["txtpassworda"]."' ";
$strSQL .=",name = '".$_POST["txtname"]."' ";
$strSQL .=",surname = '".$_POST["txtlastname"]."' ";
$strSQL .=",ques = '".$_POST["select"]."' ";
$strSQL .=",email= '".$_POST["txtemail"]."' ";
$strSQL .="WHERE user_id = '".$_GET["id"]."' ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
    echo "<br><a href=mainlessont.php>แก้ไขข้อมูลเรียบร้อยค่ะ.........</a>"; 
}else{
    echo "ข้อมูลผิดพลาดกรุณาตรวจสอบใหม่อีกครั้งค่ะ";
	echo "<br><a href=edituser.php>กลับ</a>"; 
	}
?>


ขอบคุณมากๆๆๆค่ะ



Tag : - - - -







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-01-24 19:10:09 By : ppon_9999 View : 777 Reply : 1
 

 

No. 1



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

สมาชิกที่ใส่เสื้อไทยครีเอท

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


Code (PHP)
<?php
$host = "localhost";
$username ="root";
$password ="123";
$dbname = "dbwbi";
mysql_connect($host,$username,$password)or die("ไม่สามารถติดต่อ my sql ได้");;
mysql_select_db("$dbname")or die("ไม่สามารถติดต่อฐานข้อมูลได้");
mysql_query("SET NAMES tis620");
?>


Code (PHP)
<form id="form1" name="form1" method="post" action="edituser_save.php">
		 		  <table width="98%" height="298" border="0" cellpadding="0" cellspacing="0">
        <tr>
          <th width="32%" scope="row"><div align="left">user(ชื่อผู้เข้าใช้):</div></th>
          <td width="68%"><label>
          <input type="text" name="txtusername" size=30 maxlength=12  value="<? echo $_SESSION['txtusername']; ?>" > 
            <input type="button" name="btchuser" value="ตรวจสอบชื่อผู้ใช้" />
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">password:</div></th>
          <td><label>
            <input type="password" name="txtpassworda"  value="<? echo $_SESSION['pass']; ?>" />
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">ยืนยัน password:</div></th>
          <td><input type="password" name="txtconpassword" value="" <? echo $_SESSION['pass']; ?>" />
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">ชื่อ:</div></th>
          <td><label>
            <input type="text" name="txtname" value="<? echo $_SESSION['name']; ?>"/>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">นามสกุล:</div></th>
          <td><label>
            <input type="text" name="txtlastname" value="<? echo $_SESSION['sname']; ?>"/>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">เพศ:</div></th>
          <td><label>
           <input name="rdsex1" type="radio" value="1" <? if ($_SESSION['sex']==1) {echo 'checked';}?>/>
          ชาย 
          <input name="rdex2" type="radio" value="2" <? if ($_SESSION['sex']==2) {echo 'checked';}?>/>
          หญิง</label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">อายุ:</div></th>
          <td><label>
            <select name="selectage">
              <option value="0">เลือกอายุ</option>
              <option value="1" <? if ($_SESSION['age']==1) {echo 'selected';}?>>อายุ10-12ปี</option>
              <option value="2" <? if ($_SESSION['age']==2) {echo 'selected';}?>>อายุมากกว่า 13 ปี</option>
            </select>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">การศึกษา:</div></th>
          <td><label>
            <input name="rdstudy1" type="radio" value="1"  <? if ($_SESSION['study']==1) {echo 'checked';} ?>/>
          ผู้เรียนชั้นประถมศึกษาปี่ที่ 5 
          <input name="rdstudy2" type="radio" value="2"  <? if ($_SESSION['study']==2) {echo 'checked';}?>/>
          ผู้เรียนทั่วไป
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">E-mail:</div></th>
          <td><label>
            <input type="text" name="txtemail" maxlength='50' value="<? echo $_SESSION['email']; ?>"/>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">คำถามกันลืม:</div></th>
          <td><label>
            <select name="select">
              <option value="0">เลือกคำถามที่ต้องการ</option>
              <option value="1"<? if ($_SESSION['ques']==1) {echo 'selected';}?>>ชื่อเล่น</option>
              <option value="2" <? if ($_SESSION['ques']==2) {echo 'selected';}?>>สีที่ชอบ</option>
              <option value="3" <? if ($_SESSION['ques']==3) {echo 'selected';}?>>สัตว์เลี้ยงที่ชอบ</option>
            </select>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td>&nbsp;</td>
        </tr>
        <tr>
          <th scope="row"><div align="left">คำตอบ:</div></th>
          <td><label>
            <input type="text" name="txtans" value="<? echo $_SESSION['ans']; ?>"/>
          </label></td>
        </tr>
        <tr>
          <th scope="row">&nbsp;</th>
          <td><label>
            <input type="hidden" name="userid" value="<?=$_GET[id];?>">
            <input type="submit" name="btsubmit" value="ตกลง" />
            <input type="reset" name="btcancle" value="ยกเลิก" />
          </label></td>
        </tr>
      </table>
          </form>


Code (PHP)
<?
include ("connectdb.php");
$strSQL = "UPDATE tbluser  SET ";
$strSQL .="username = '".$_POST["txtusername"]."' ";
$strSQL .=",password = '".$_POST["txtpassworda"]."' ";
$strSQL .=",name = '".$_POST["txtname"]."' ";
$strSQL .=",surname = '".$_POST["txtlastname"]."' ";
$strSQL .=",ques = '".$_POST["select"]."' ";
$strSQL .=",email= '".$_POST["txtemail"]."' ";
$strSQL .=" WHERE user_id = '".$_POST["userid"]."' ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
    echo "<br><a href=mainlessont.php>แก้ไขข้อมูลเรียบร้อยค่ะ.........</a>"; 
}else{
    echo "ข้อมูลผิดพลาดกรุณาตรวจสอบใหม่อีกครั้งค่ะ";
	echo "<br><a href=edituser.php>กลับ</a>"; 
	}
?>







Date : 2010-01-24 19:55:23 By : kennyg
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : รบกวนพี่ๆช่วยดูให้หน่อยค่ะ...น้องสงสัยอย่างแรง เป็นโค้ดแก้ไขข้อมูลสมาชิกอะค่ะ ตอนแก้ไขข้อมูลแล้วสามารถแก้ไขได้
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 03
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 อัตราราคา คลิกที่นี่