I am getting the following error:
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 ')' at line 1
MySQL server version is 5.0
what is going on? I see nothing wrong with am I missing something?
<?php
require_once('connectfile.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"] == "satisfaction-survey")) {
$insertSQL = sprintf("INSERT INTO Customer_Satisfaction (survey_id, question1, question2, question3, question4, question5, question6, question7, question8, question9, question10, question11, question12, question13, question14, question15, comments, company, address, name, title, email) VALUES (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, )",
GetSQLValueString($_POST['survey_id'], "text"),
GetSQLValueString($_POST['question1'], "text"),
GetSQLValueString($_POST['question2'], "text"),
GetSQLValueString($_POST['question3'], "text"),
GetSQLValueString($_POST['question4'], "text"),
GetSQLValueString($_POST['question5'], "text"),
GetSQLValueString($_POST['question6'], "text"),
GetSQLValueString($_POST['question7'], "text"),
GetSQLValueString($_POST['question8'], "text"),
GetSQLValueString($_POST['question9'], "text"),
GetSQLValueString($_POST['question10'], "text"),
GetSQLValueString($_POST['question11'], "text"),
GetSQLValueString($_POST['question12'], "text"),
GetSQLValueString($_POST['question13'], "text"),
GetSQLValueString($_POST['question14'], "text"),
GetSQLValueString($_POST['question15'], "text"),
GetSQLValueString($_POST['comments'], "text"),
GetSQLValueString($_POST['company'], "text"),
GetSQLValueString($_POST['address'], "text"),
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['title'], "text"),
GetSQLValueString($_POST['email'], "text"));
mysql_select_db($database_Survey, $Survey);
$Result1 = mysql_query($insertSQL, $Survey) or die(mysql_error());
$insertGoTo = "include/customer-satisfaction-ok.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>