|
|
|
update ข้อมูลไม่ได้แต่ฟ้องว่า update OK ขอความช่วยเหลือครับผม |
|
|
|
|
|
|
|
รบกวนช่วยดูโค้ดให้หน่อยนะครับ คือว่าupdate ข้อมูลแล้วไม่ได้แต่ก็บอกว่า update ok อยากจะรู้ว่าจะต้องทำยังติดตรงไหนบ้างครับ
Code (PHP)
<?php require_once('./Connections/db_conn.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>SaveEdit</title>
</head>
<body>
<?
mysql_connect($hostname_db_conn,$username_db_conn,$password_db_conn);
mysql_select_db($database_db_conn) or die("Error Connect to Database");
mysql_query('SET CHARACTER SET utf8');
$objDB = mysql_select_db("profilecomputer");
$strSQL = "UPDATE profilecomputer SET ";
$strSQL .="locBud = '".$_POST["field1"]."' ";
$strSQL .=",locFlr = '".$_POST["field2"]."' ";
$strSQL .=",oROELocation = '".$_POST["field3"]."' ";
$strSQL .=",Location1 = '".$_POST["field4"]."' ";
$strSQL .=",TYPE = '".$_POST["field5"]."' ";
$strSQL .=",comID = '".$_POST["field6"]."' ";
$strSQL .=",comSN = '".$_POST["field7"]."' ";
$strSQL .=",Brand = '".$_POST["field8"]."' ";
$strSQL .=",Model = '".$_POST["field9"]."' ";
$strSQL .=",mtID = '".$_POST["field10"]."' ";
$strSQL .=",M_SerialNo = '".$_POST["field11"]."' ";
$strSQL .=",ownPin = '".$_POST["field12"]."' ";
$strSQL .=",ownTn = '".$_POST["field13"]."' ";
$strSQL .=",ownMail = '".$_POST["field14"]."' ";
$strSQL .=",ownComp = '".$_POST["field15"]."' ";
$strSQL .=",ownEvp = '".$_POST["field16"]."' ";
$strSQL .=",ownVp = '".$_POST["field17"]."' ";
$strSQL .=",ownAvp = '".$_POST["field18"]."' ";
$strSQL .=",ownDp = '".$_POST["field19"]."' ";
$strSQL .=",ownSc = '".$_POST["field20"]."' ";
$strSQL .=",Telephone = '".$_POST["field21"]."' ";
$strSQL .=",AssetCode = '".$_POST["field22"]."' ";
$strSQL .=",IPAddress = '".$_POST["field23"]."' ";
$strSQL .=",KeyboardID = '".$_POST["field24"]."' ";
$strSQL .=",K_SerialNo = '".$_POST["field25"]."' ";
$strSQL .=",startdate = '".$_POST["popup_container"]."' ";
$strSQL .=",dendline = '".$_POST["popup_container2"]."' ";
$strSQL .=",workage = '".$_POST["field26"]."' ";
$strSQL .=",CPU = '".$_POST["field27"]."' ";
$strSQL .=",HDD = '".$_POST["field28"]."' ";
$strSQL .=",RAM = '".$_POST["field29"]."' ";
$strSQL .=",LAN = '".$_POST["field30"]."' ";
$strSQL .=",WLAN = '".$_POST["field31"]."' ";
$strSQL .=",BT = '".$_POST["field32"]."' ";
$strSQL .=",Infared = '".$_POST["field33"]."' ";
$strSQL .=",genaral = '".$_POST["field34"]."' ";
$strSQL .="WHERE comID = '".$_GET["comID"]."' ";
$objQuery = mysql_query($strSQL);
if($objQuery) echo " OK Update";
else echo "----".mysql_error();
?>
<?
mysql_close();
?>
</body>
</html>
Tag : PHP
|
|
|
|
|
|
Date :
2011-04-08 14:58:19 |
By :
thelak |
View :
656 |
Reply :
6 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$objQuery = mysql_query($strSQL) or die(mysql_error());
|
|
|
|
|
Date :
2011-04-08 15:19:12 |
By :
PlaKriM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ยังไม่ได้ครับ ประมาณว่า ค้นหาข้อมูลขึ้นมาแล้วทำการแก้ไขครับ
|
|
|
|
|
Date :
2011-04-08 15:30:54 |
By :
thelak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
มันไ่ม่มี error ออกมาหรอ
อย่าตอบแค่ไม่ได้ครับ ไม่ได้ยังไงบอกด้วย จะได้คำตอบที่ดีกว่านี้
|
|
|
|
|
Date :
2011-04-08 15:54:15 |
By :
PlaKriM |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
โทษทีครับ ไม่ error อะไรเลยครับผมไม่รู้ว่ามันส่งมาค่าให้หรือป่าวครับ
โค้ดFormedit ครับเป็นโค้ดที่ส่งค่า ไปยัง SaveEdit ไฟล์ด้านบนครับ
Code (PHP)
<?php require_once('./Connections/db_conn.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>Edit</title>
<style type="text/css">
<!--
body,td,th {
font-family: AngsanaUPC, MS Sans Serif, Arial;
font-size: 14px;
}
.style1 {color: #3399FF}
-->
</style>
<link rel="stylesheet" type="text/css" href="epoch_styles.css" />
<script type="text/javascript" src="epoch_classes.js"></script>
<script type="text/javascript">
/*You can also place this code in a separate file and link to it like epoch_classes.js*/
var bas_cal,dp_cal,ms_cal;
window.onload = function () {
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container'));
dp_cal = new Epoch('epoch_popup','popup',document.getElementById('popup_container2'));
ms_cal = new Epoch('epoch_multi','flat',document.getElementById('multi_container'),true);
};
</script>
</head>
<body>
<table width="515" height="324" border="0" cellpadding="0" cellspacing="0">
<tr>
<td width="139"> </td>
<td width="376" valign="top"><form action="SaveEdit.php" method="GET" name="formedit"><table width="351" border="0" cellspacing="0" cellpadding="0">
<?
mysql_connect($hostname_db_conn,$username_db_conn,$password_db_conn);
mysql_select_db($database_db_conn) or die("Error Connect to Database");
mysql_query('SET CHARACTER SET utf8');
$strSQL = "SELECT * FROM profilecomputer where comID = '".$_GET["comID"]."'";
$objDB = mysql_select_db("profilecomputer");
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found HerbId=".$_GET["comID"];
}
else
{
?>
<tr>
<td width="68" height="31"><span class="style1">
<label for="checkbox_row_1">locBud</label>
<label for="checkbox_row_2"></label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field1" id="field1" value="<?=$objResult["locBud"];?>" />
</label></td>
<td width="132"><select name="select" id="select" onChange="formedit.field1.value=this.value" >
<option selected="selected">-----</option>
<option value="BDON">BDON</option>
<option value="BDON SUB">BDON SUB</option>
</select></td>
</tr>
<tr>
<td height="34"><span class="style1">
<label for="checkbox_row_2">locFlr</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field2" id="field2" value="<?=$objResult["locFlr"];?>" />
</label></td>
<td><select name="select2" id="select2" onChange="formedit.field2.value=this.value" >
<option selected="selected">-----</option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select></td>
</tr>
<tr>
<td height="30"><span class="style1">
<label for="checkbox_row_3">oROELocation</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field3" id="field3" value="<?=$objResult["oROELocation"];?>" />
</label></td>
<td><select name="select3" id="select3" onChange="formedit.field3.value=this.value" >
<option selected="selected">------</option>
<option value="EN_KKN">EN_KKN</option>
</select></td>
</tr>
<tr>
<td height="30"><span class="style1">
<label for="checkbox_row_4">Location1</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field4" id="field4" value="<?=$objResult["Location1"];?>"/>
</label></td>
<td><select name="select4" id="select4" onChange="formedit.field4.value=this.value">
<option selected="selected">------</option>
<option value="EN_KKN">EN_KKN</option>
</select></td>
</tr>
<tr>
<td height="31"><span class="style1">
<label for="checkbox_row_5">TYPE</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field5" id="field5" value="<?=$objResult["TYPE"];?>" />
</label></td>
<td><select name="select5" id="select5" onChange="formedit.field5.value=this.value">
<option selected="selected" >------</option>
<option value="NOTEBOOK">NOTEBOOK</option>
<option value="PC">PC</option>
<option value="PRINTER">PRINTER</option>
<option value="MORNITER">MORNITER</option>
</select></td>
</tr>
<tr>
<td height="26"><span class="style1">
<label for="checkbox_row_6">comid</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field6" id="field6" value="<?=$objResult["comID"];?>" />
</label></td>
</tr>
<tr>
<td height="26"><span class="style1">
<label for="checkbox_row_7">comSN</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field7" id="field7" value="<?=$objResult["comSN"];?>" />
</label></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_8">Brand</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field8" id="field8" value="<?=$objResult["Brand"];?>"/>
</label></td>
</tr>
<tr>
<td height="29"><span class="style1">
<label for="checkbox_row_9">Model</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field9" id="field9" value="<?=$objResult["Model"];?>" />
</label></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_10">mtID</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field10" id="field10" value="<?=$objResult["mtID"];?>" />
</label></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_11">M_SerialNo</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field11" id="field11" value="<?=$objResult["M_SerialNo"];?>" />
</label></td>
</tr>
<tr>
<td height="26"><span class="style1">
<label for="checkbox_row_12">ownPin</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field12" id="field12" value="<?=$objResult["ownPin"];?>" />
</label></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_13">ownTn</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field13" id="field13" value="<?=$objResult["ownTn"];?>" />
</label></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_14">ownMail</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field14" id="field14" value="<?=$objResult["ownMail"];?>" />
</label></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_15">ownComp</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field15" id="field15" value="<?=$objResult["ownComp"];?>" />
</label></td>
<td><select name="select6" id="select6" onChange="formedit.field15.value=this.value">
<option selected="selected" >---</option>
<option value="AIS">AIS</option>
</select></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_16">ownEvp</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field16" id="field16" value="<?=$objResult["ownEvp"];?>" />
</label></td>
<td><select name="select7" id="select7" onChange="formedit.field16.value=this.value">
<option selected="selected" >---</option>
<option value="SO">SO</option>
</select></td>
</tr>
<tr>
<td height="33"><span class="style1">
<label for="checkbox_row_17">ownVp</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field17" id="field17" value="<?=$objResult["ownVp"];?>" />
</label></td>
<td><select name="select8" id="select8" onChange="formedit.field17.value=this.value">
<option selected="selected" >---</option>
<option value="RO">RO</option>
</select></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_18">ownAvp</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field18" id="field18" value="<?=$objResult["ownAvp"];?>" />
</label></td>
<td><select name="select9" id="select9" onChange="formedit.field18.value=this.value">
<option selected="selected" >---</option>
<option value="RONE">RONE</option>
</select></td>
</tr>
<tr>
<td height="30"><span class="style1">
<label for="checkbox_row_19">ownDp</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field19" id="field19" value="<?=$objResult["ownDp"];?>" />
</label></td>
<td><select name="select10" id="select10" onChange="formedit.field19.value=this.value">
<option selected="selected" >---</option>
<option value="DP-TO-UNE">DP-TO-UNE</option>
</select></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_20">ownSc</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field20" id="field20" value="<?=$objResult["ownSc"];?>" />
</label></td>
<td><select name="select11" id="select11" onChange="formedit.field20.value=this.value">
<option selected="selected" >---</option>
<option value="SC-EN-KKN">SC-EN-KKN</option>
</select></td>
</tr>
<tr>
<td height="29"><span class="style1">
<label for="checkbox_row_21">Telephone</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field21" id="field21" value="<?=$objResult["Telephone"];?>"/>
</label></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_22">AssetCode</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field22" id="field22" value="<?=$objResult["AssetCode"];?>" />
</label></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_23">IPAddress</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field23" id="field23" value="<?=$objResult["IPAddress"];?>" />
</label></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_24">KeyboardID</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field24" id="field24" value="<?=$objResult["KeyboardID"];?>" />
</label></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_25">K_SerialNo</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field25" id="field25" value="<?=$objResult["K_SerialNo"];?>" />
</label></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_26">startdate</label>
</span></td>
<td colspan="3"><label>
<input id="popup_container" type="text" value="<?=$objResult["startdate"];?>" />
</label></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_27">dendline</label>
</span></td>
<td colspan="3"><label>
<input id="popup_container2" type="text" value="<?=$objResult["dendline"];?>" />
</label></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_28">workage</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field26" id="field26" value="<?=$objResult["workage"];?>"/>
</label></td>
</tr>
<tr>
<td height="26"><span class="style1">
<label for="checkbox_row_29">CPU</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field27" id="field27" value="<?=$objResult["CPU"];?>" />
</label></td>
</tr>
<tr>
<td height="26"><span class="style1">
<label for="checkbox_row_30">HDD</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field28" id="field28" value="<?=$objResult["HDD"];?>" />
</label></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_31">RAM</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field29" id="field29" value="<?=$objResult["RAM"];?>" />
</label></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_32">LAN</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field30" id="field30" value="<?=$objResult["LAN"];?>" />
</label></td>
<td><select name="select12" id="select12" onChange="formedit.field30.value=this.value">
<option selected="selected" >---</option>
<option value="YES">YES</option>
<option value="NO">NO</option>
</select></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_33">WLAN</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field31" id="field31" value="<?=$objResult["WLAN"];?>" />
</label></td>
<td><select name="select13" id="select13" onChange="formedit.field31.value=this.value">
<option selected="selected" >---</option>
<option value="YES">YES</option>
<option value="NO">NO</option>
</select></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_34">BT</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field32" id="tfield32" value="<?=$objResult["BT"];?>"/>
</label></td>
<td><select name="select14" id="select14" onChange="formedit.field32.value=this.value">
<option selected="selected" >---</option>
<option value="YES">YES</option>
<option value="NO">NO</option>
</select></td>
</tr>
<tr>
<td height="27"><span class="style1">
<label for="checkbox_row_35">Infared</label>
</span></td>
<td colspan="2"><label>
<input type="text" name="field33" id="field33" value="<?=$objResult["Infared"];?>" />
</label></td>
<td><select name="select15" id="select15" onChange="formedit.field33.value=this.value">
<option selected="selected" >---</option>
<option value="YES">YES</option>
<option value="NO">NO</option>
</select></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_36">genaral</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field34" id="field34" value="<?=$objResult["genaral"];?>" />
</label></td>
</tr>
<tr>
<td height="28"><span class="style1">
<label for="checkbox_row_37">remark</label>
</span></td>
<td colspan="3"><label>
<input type="text" name="field35" id="field35" value="<?=$objResult["remark"];?>" />
</label></td>
</tr>
<tr>
<td> </td>
<td width="66"><div align="center">
<label>
<input type="submit" name="button" id="button" value="save" />
</label>
</div>
<label></label></td>
<td width="85"><input type="reset" name="button2" id="button2" value="cancel" /></td>
<td> </td>
</tr>
<tr>
<td> </td>
<td colspan="3"> </td>
</tr>
<tr>
<td> </td>
<td colspan="3"> </td>
<?
}
mysql_close();
?>
</tr>
</table>
</form></td>
</tr>
</table>
</body>
</html>
|
|
|
|
|
Date :
2011-04-08 16:03:06 |
By :
thelak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$objQuery = mysql_query($strSQL) or die(mysql_error());
เอา error มาโชว์
echo strsql ออกมาดู
เอา sql ที่ echo ไป query ใน phpmyadmin แล้วเอา error มาดู
|
ประวัติการแก้ไข 2011-04-08 16:15:17
|
|
|
|
Date :
2011-04-08 16:14:55 |
By :
silasakk |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วครับ แก้ที่ตรงนี้ครับ <form action="SaveEdit.php?comID=<?=$_GET["comID"];?>" method="POST" name="formedit"> ที่ไฟล์ formedit ครับ ขอบคุณสำหรับทุกความช่วยเหลือครับผม
|
|
|
|
|
Date :
2011-04-08 16:17:49 |
By :
thelak |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 02
|