|
|
|
ช่วยดูไห้หน่อยคะ ไม่รู้ว่าไปเพี่มต่รงไหนเลียทำไห้เวลา edit ข้อมูล.. ข้อมูลที่ edit จะไม่เห็นเลียคะ ไม่ใช่ delete นะคะ |
|
|
|
|
|
|
|
มีอยู่ 2 file คะ ไม่รู้ว่าผิดต่รงไหนหาจนตาลายแล้วยังไม่พบเลียคะ..
กราบ...ขอบพะคุญนะคะ
1...phpMySQLEditRecordForm.php
Code (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>Untitled Document</title>
</head>
<body>
<form action="phpMySQLEditRecordSave.php?ShortID=<?=$_GET["ShortID"];?>" name="frmEdit" method="post">
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM shortcode WHERE ShortcodeName = '".$_GET["ShortID"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found Shortcode ID=".$_GET["ShortID"];
}
else
{
?>
<table border="1" cellpadding="0" cellspacing="2" width="50%" align="center">
<tr>
<td height="30" colspan="0" align="center" bgcolor="#B0B0FF"><font size="4" >ດັດແກ້ຂໍ້ມູນ Shortcode</font></td>
</tr>
<table border="1" cellpadding="0" cellspacing="2" width="50%" align="center">
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">Shortcode : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtShortcode" type="text" id="txtShortcode" style="border-color:#CCF" value="<?=$objResult["ShortcodeName"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ຊື່ບໍລິສັດ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtCompany" type="text" id="txtCompany" style="border-color:#CCF" value="<?=$objResult["Company"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ເລີ່ມຕົ້ນ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtEffectTime" type="text" id="txtEffectTime" style="border-color:#CCF" value="<?=$objResult["Effect_time"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ໝົດອາຍຸ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtExpireTime" type="text" id="txtExpireTime" style="border-color:#CCF" value="<?=$objResult["Expire_time"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ສັນຍາເລກທີ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtReference" type="text" id="txtReference" style="border-color:#CCF" value="<?=$objResult["Reference"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ລາຄາ/sms : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtPrice" type="text" id="txtPrice" style="border-color:#CCF" value="<?=$objResult["Price"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ອາກອນ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtTax" type="text" id="txtTax" style="border-color:#CCF" value="<?=$objResult["Tax"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ສ່ວນແບ່ງ ETL : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtShareETL" type="text" id="txtShareETL" style="border-color:#CCF" value="<?=$objResult["Share_ETL"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ສ່ວນແບ່ງ Partner : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtSharepartner" type="text" id="txtSharepartner" style="border-color:#CCF" value="<?=$objResult["Share_partner"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ເບີຕິດຕໍ່ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtTel" type="text" id="txtTel" style="border-color:#CCF" value="<?=$objResult["Tel"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ໝາຍເຫດ :</div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtNote" type="text" id="txtNote" style="border-color:#CCF" value="<?=$objResult["Note"];?>" size="50" />
</span></td>
</tr>
</table>
<?
}
mysql_close($objConnect);
?>
<p></p>
<tr>
<td><div align="center"><input type="submit" name="button" id="button" value="Save" style="width:100px;height:30px" >
<input type=button onClick="window.history.back()" value="Back" style="width:100px;height:30px">
</div></td>
<td><div align="center"></div></td>
</tr>
</table>
</form>
</body>
</html>
2..phpMySQLEditRecordSave.php
Code (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>Untitled Document</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "UPDATE shortcode SET ";
$strSQL .="ShortcodeName = '".$_POST["txtShortcode"]."' ";
$strSQL .=",Company = '".$_POST["txtCompany"]."' ";
$strSQL .=",Effect_time = '".$_POST["txtEffectTime"]."' ";
$strSQL .=",Expire_time = '".$_POST["txtExpireTime"]."' ";
$strSQL .=",Reference = '".$_POST["txtReference"]."' ";
$strSQL .=",Price = '".$_POST["txtPrice"]."' ";
$strSQL .=",Tax = '".$_POST["txtTax"]."' ";
$strSQL .=",Share_ETL = '".$_POST["txtShareETL"]."' ";
$strSQL .=",Share_partner = '".$_POST["txtSharepartner"]."' ";
$strSQL .=",Tel = '".$_POST["txtTel"]."' ";
$strSQL .=",Note = '".$_POST["txtNote"]."' ";
$strSQL .="WHERE ShortcodeName = '".$_GET["ShortID"]."' " ;
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo "<script language='javascript'>alert('แปงข้อมูลเรียบร้อยแล้ว'); window.location = 'win3.php'; </script>";
}
else
{
echo "Error Save [".$strSQL."]";
}
mysql_close($objConnect);
?>
</body>
</html>
Tag : PHP, MySQL
|
|
|
|
|
|
Date :
2012-06-05 17:07:06 |
By :
Cat |
View :
942 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
phpMySQLEditRecordForm.php(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>Untitled Document</title>
</head>
<body>
<form action="phpMySQLEditRecordSave.php?ShortID=<?=$_GET["ShortID"];?>" name="frmEdit" method="post">
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "SELECT * FROM shortcode WHERE ShortcodeName = '".$_GET["ShortID"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found Shortcode ID=".$_GET["ShortID"];
}
else
{
?>
<!--ส่ง $_GET["ShortID"] ไปกับฟอร์มด้วย-->
<input type="hidden" name="ShortID" value="<?=$_GET["ShortID"]?>">
<table border="1" cellpadding="0" cellspacing="2" width="50%" align="center">
<tr>
<td height="30" colspan="0" align="center" bgcolor="#B0B0FF"><font size="4" >ດັດແກ້ຂໍ້ມູນ Shortcode</font></td>
</tr>
<table border="1" cellpadding="0" cellspacing="2" width="50%" align="center">
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">Shortcode : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtShortcode" type="text" id="txtShortcode" style="border-color:#CCF" value="<?=$objResult["ShortcodeName"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ຊື່ບໍລິສັດ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtCompany" type="text" id="txtCompany" style="border-color:#CCF" value="<?=$objResult["Company"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ເລີ່ມຕົ້ນ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtEffectTime" type="text" id="txtEffectTime" style="border-color:#CCF" value="<?=$objResult["Effect_time"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ໝົດອາຍຸ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtExpireTime" type="text" id="txtExpireTime" style="border-color:#CCF" value="<?=$objResult["Expire_time"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ສັນຍາເລກທີ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtReference" type="text" id="txtReference" style="border-color:#CCF" value="<?=$objResult["Reference"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ລາຄາ/sms : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtPrice" type="text" id="txtPrice" style="border-color:#CCF" value="<?=$objResult["Price"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ອາກອນ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtTax" type="text" id="txtTax" style="border-color:#CCF" value="<?=$objResult["Tax"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ສ່ວນແບ່ງ ETL : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtShareETL" type="text" id="txtShareETL" style="border-color:#CCF" value="<?=$objResult["Share_ETL"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ສ່ວນແບ່ງ Partner : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtSharepartner" type="text" id="txtSharepartner" style="border-color:#CCF" value="<?=$objResult["Share_partner"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ເບີຕິດຕໍ່ : </div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtTel" type="text" id="txtTel" style="border-color:#CCF" value="<?=$objResult["Tel"];?>" size="50" />
</span></td>
</tr>
<tr>
<td class="tbl1" style="white-space: nowrap;"><div align="right">ໝາຍເຫດ :</div></td>
<td class="tbl1" style="white-space: nowrap;"><span class="tbl1" style="white-space: nowrap;">
<input name="txtNote" type="text" id="txtNote" style="border-color:#CCF" value="<?=$objResult["Note"];?>" size="50" />
</span></td>
</tr>
</table>
<?
}
mysql_close($objConnect);
?>
<p></p>
<tr>
<td><div align="center"><input type="submit" name="button" id="button" value="Save" style="width:100px;height:30px" >
<input type=button onClick="window.history.back()" value="Back" style="width:100px;height:30px">
</div></td>
<td><div align="center"></div></td>
</tr>
</table>
</form>
</body>
</html>
phpMySQLEditRecordSave.php(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>Untitled Document</title>
</head>
<body>
<?
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
$strSQL = "UPDATE shortcode SET ";
$strSQL .="ShortcodeName = '".$_POST["txtShortcode"]."' ";
$strSQL .=",Company = '".$_POST["txtCompany"]."' ";
$strSQL .=",Effect_time = '".$_POST["txtEffectTime"]."' ";
$strSQL .=",Expire_time = '".$_POST["txtExpireTime"]."' ";
$strSQL .=",Reference = '".$_POST["txtReference"]."' ";
$strSQL .=",Price = '".$_POST["txtPrice"]."' ";
$strSQL .=",Tax = '".$_POST["txtTax"]."' ";
$strSQL .=",Share_ETL = '".$_POST["txtShareETL"]."' ";
$strSQL .=",Share_partner = '".$_POST["txtSharepartner"]."' ";
$strSQL .=",Tel = '".$_POST["txtTel"]."' ";
$strSQL .=",Note = '".$_POST["txtNote"]."' ";
$strSQL .="WHERE ShortcodeName = '".$_POST["ShortID"]."' " ;
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo "<script language='javascript'>alert('แปงข้อมูลเรียบร้อยแล้ว'); window.location = 'win3.php'; </script>";
}
else
{
echo "Error Save [".$strSQL."]";
}
mysql_close($objConnect);
?>
</body>
</html>
|
|
|
|
|
Date :
2012-06-05 18:05:24 |
By :
mangkunzo |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|