ขึ้นแบบนี้ค่ะ You have an error in your SQL syntax; check the manual that corresponds to your
พอกดบันทึกก็ขึ้นแบบนี้ค่ะ ควรแก้อย่างไรดีคะ ขอบคุณมากค่ะ
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ') VALUES ('นายสิบเà¸à¹‡à¸”', 'สิบเà¸à¹‡à¸”', 'mobile2', ' at line 1
Code (PHP)
<?php
require_once('Connections/AddDataCustomers.php');
?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
if (PHP_VERSION < 6) {
$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($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
$insertSQL = sprintf("INSERT INTO data_customers (ctm_name, ctm_surname, ctm_product, ctm_model, ctm_tel, ctm_date, ctm_fix, ) VALUES (%s, %s, %s, %s, %s, %s, %s,)",
GetSQLValueString($_POST['ctm_name'], "text"),
GetSQLValueString($_POST['ctm_surname'], "text"),
GetSQLValueString($_POST['ctm_product'], "text"),
GetSQLValueString($_POST['ctm_model'], "text"),
GetSQLValueString($_POST['ctm_tel'], "int"),
GetSQLValueString($_POST['ctm_date'], "date"),
GetSQLValueString($_POST['ctm_fix'], "text"));
mysql_select_db($database_AddDataCustomers, $AddDataCustomers);
$Result1 = mysql_query($insertSQL, $AddDataCustomers) or die(mysql_error());
$insertGoTo = "data_customers.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
Tag : PHP, MySQL
Date :
2013-11-19 20:33:31
By :
aorplus
View :
754
Reply :
2
INSERT INTO data_customers (ctm_name, ctm_surname, ctm_product, ctm_model, ctm_tel, ctm_date, ctm_fix, ) VALUES (%s, %s, %s, %s, %s, %s, %s,)
ตัวแดงๆ มันเกินมาตัวนึงครับ
Date :
2013-11-19 21:32:35
By :
arm8957
ขอบคุณมากๆค่ะ
Date :
2013-11-19 21:42:03
By :
aorplus
Load balance : Server 03