|
|
|
ขอความช่วยเหลือเรื่อง edit ด่วนครับ ผมแก้ไขฟอร์อมไม่ได้เลยครับ มันขึ้นแบบนี้ครับ Error Save |
|
|
|
|
|
|
|
ผมแก้ไขฟอร์อมไม่ได้เลยคัรบ
Code (PHP)
<a href="change_profile_form2.php?id=<?=$row["id"]?>">แก้ไข</a>
change_profile_form2.php
<form method="post" action="change_profile.php?id=<?=$_GET["id"];?>">
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("bbb");
$strSQL = "SELECT * FROM member WHERE id = '".$_GET["id"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found id=".$_GET["id"];
}
else
{
?>
<input name="id" type="text" class="LeftMenu" value="<?=$objResult["id"]?>" size="30" readonly="readonly" disabled="disabled"/>
<input name="username" type="text" class="LeftMenu" value="<?=$objResult["username"]?>" size="30" readonly="readonly" disabled="disabled"/>
<input name="password" type="password" size="30" value="<?=$objResult["password"]?>"/>
<input name="name" type="text" size="30" value="<?=$objResult["name"]?>"/>
<input name="surname" type="text" size="30" value="<?=$objResult["surname"]?>"/>
<input name="department" type="text" size="30" value="<?=$objResult["department"]?>"/>
<input name="position" type="text" size="30" value="<?=$objResult["position"]?>"/>
<input name="PIN" type="text" size="30" value="<?=$objResult["PIN"]?>"/>
<input name="tel" type="text" size="30" value="<?=$objResult["tel"]?>"/>
<input name="email" type="text" size="30" value="<?=$objResult["email"]?>" />
<textarea name="address" cols="40" rows="3"><?=$objResult["address"]?>
</textarea>
<select name="status" id="status">
<option>กรุณาเลือกระดับ</option>
<option value="admin">ผู้ดูแลระบบ</option>
<option value="staff">พนักงาน</option>
<option value="user" selected="selected">ผู้ใช้</option>
</select>
<input name="lastLogout" type="text" class="LeftMenu" value="<?=$objResult["lastLogout"]?>" size="30" readonly="readonly" disabled="disabled"/>
<input type="submit" value="เปลี่ยน" />
<input type="reset" value="เคลียร์" />
<input name="btnButton" type="button" value="กลับ" onclick="VbScript:history.back()" />
<?
}
mysql_close($objConnect);
?>
</form>
change_profile.php
<?
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("bbb");
$strSQL = "UPDATE member SET ";
$strSQL .="id = '".$_POST["id"]."' ";
$strSQL .=",password = '".$_POST["password"]."' ";
$strSQL .=",name = '".$_POST["name"]."' ";
$strSQL .=",surname = '".$_POST["surname"]."' ";
$strSQL .=",department = '".$_POST["department"]."' ";
$strSQL .=",position = '".$_POST["position"]."' ";
$strSQL .=",PIN = '".$_POST["PIN"]."' ";
$strSQL .=",tel = '".$_POST["tel"]."' ";
$strSQL .=",email = '".$_POST["email"]."' ";
$strSQL .=",address = '".$_POST["address"]."' ";
$strSQL .=",status = '".$_POST["status"]."' ";
$strSQL .="WHERE id = '".$_GET["id"]."' ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo "Save Done.";
}
else
{
echo "Error Save [".$strSQL."]";
}
mysql_close($objConnect);
?>
แล้วมันขึ้นแบบนี้ครับ
Error Save [UPDATE member SET id = '' ,password = '1234' ,name = 'test' ,surname = '555' ,department = 'aaaa' ,position = 'aaaa' ,PIN = '111111' ,tel = '11111' ,email = '111' ,address = '1111 ' ,status = 'user' WHERE id = '14' ]
Tag : - - - -
|
|
|
|
|
|
Date :
2010-02-09 10:47:46 |
By :
jiebspy |
View :
769 |
Reply :
1 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
05.$strSQL .="id = '".$_POST["id"]."' ";จำเป็นต้อง Set ID ใหม่ด้วยเหรอ
|
|
|
|
|
Date :
2010-02-09 11:26:42 |
By :
ความรู้เท่าหางอึ่ง |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 05
|