|
 |
|
ช่วยดูโค๊ดให้หน่อยคะ พอแก้ไขข้อมูลในตารางแล้วมันไม่ไป update ที่ฐานข้อมูลให้อะคะ |
|
 |
|
|
 |
 |
|
ไม่รู้ผิดตรงไหน เพราะใช้เครื่องมือใน Dream ช่วยเขียนคะ มือใหม่นะคะ
Code (PHP)
<?php require_once('../Connections/mong.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}
$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
$editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}
if ((isset($_GET["MM_update"])) && ($_GET["MM_update"] == "form1")) {
$updateSQL = sprintf("UPDATE cscs_m SET Sub_Name=%s, Province=%s, SCADA=%s WHERE `Index`=%s AND Sub_ID=%s",
GetSQLValueString($_GET['textfield5'], "text"),
GetSQLValueString($_GET['textfield3'], "text"),
GetSQLValueString($_GET['textfield4'], "text"),
GetSQLValueString($_GET['textfield'], "double"),
GetSQLValueString($_GET['textfield2'], "text"));
mysql_select_db($database_mong, $mong);
$Result1 = mysql_query($updateSQL, $mong) or die(mysql_error());
$updateGoTo = "Edit3.php";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $updateGoTo));
}
$colname_detail_sub = "-1";
if (isset($_GET['Sub'])) {
$colname_detail_sub = $_GET['Sub'];
}
mysql_select_db($database_mong, $mong);
$query_detail_sub = sprintf("SELECT * FROM cscs_m WHERE Sub_ID = %s", GetSQLValueString($colname_detail_sub, "text"));
$detail_sub = mysql_query($query_detail_sub, $mong) or die(mysql_error());
$row_detail_sub = mysql_fetch_assoc($detail_sub);
$totalRows_detail_sub = mysql_num_rows($detail_sub);
Tag : - - - -

|
|
 |
 |
 |
 |
Date :
2010-07-12 11:00:32 |
By :
Anmedy |
View :
1076 |
Reply :
1 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
echo $updateSQL;
ลองเอาค่าที่ได้ไปรันใน phpMyAdmin ครับ สำหรับ code ผมแนะนำให้เขียนเองดีกว่าใช้โปรแกรมพวกนี้เขียนครับ เขียนเองได้เรียนรู้อะไรมากมายจริง ๆ ครับ
|
 |
 |
 |
 |
Date :
2010-07-12 21:50:34 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|