|
|
|
สืบเนี่องจากกระทู้ที่แล้ว...เรื่องภาษาในฐานข้อมูลค่ะ จากที่ทุกท่านแนะนำนะค่ะ วิธีการแก้ภาษาแต่ว่า... |
|
|
|
|
|
|
|
ต้องดูที่โคด แล้วหล่ะครับ
|
|
|
|
|
Date :
2009-10-27 17:21:25 |
By :
panyapol |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
<?php
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = (!get_magic_quotes_gpc()) ? addslashes($theValue) : $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($_POST["MM_insert"])) && ($_POST["MM_insert"] == "formadd")) {
$insertSQL = sprintf("INSERT INTO user (username, password, name, surname, sex, age, educate, email, ques, ans) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
GetSQLValueString($_POST['txtuser'], "text"),
GetSQLValueString($_POST['txtpass'], "text"),
GetSQLValueString($_POST['txtname'], "text"),
GetSQLValueString($_POST['txtsur'], "text"),
GetSQLValueString($_POST['RadioGroup1'], "text"),
GetSQLValueString($_POST['select'], "int"),
GetSQLValueString($_POST['RadioGroup2'], "int"),
GetSQLValueString($_POST['txtemail'], "text"),
GetSQLValueString($_POST['select2'], "int"),
GetSQLValueString($_POST['txtqus'], "text"));
mysql_select_db($database_dbwbi, $dbwbi);
$Result1 = mysql_query($insertSQL, $dbwbi) or die(mysql_error());
$insertGoTo = "Insertok.html";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
ช่วยรบกวนดูให้หน่อยนะค่ะ
ไม่รู้จะแก้อย่างไงดี
|
|
|
|
|
Date :
2009-10-27 17:38:28 |
By :
ppon_9999 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|