Hi Folks,
I am getting the 'Headers Already Sent ’ error on this bit of code but i can’t figure out why.
Can anyone enlighten me?
<?php require_once('Connections/con_quiz.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($mm_abort_edit) || !$mm_abort_edit) {
if ((isset($_POST["MM_update"])) && ($_POST["MM_update"] == "frm_answers")) {
$updateSQL = sprintf("UPDATE score SET `1`=%s, `2`=%s, `3`=%s, `4`=%s, `5`=%s WHERE id=%s",
GetSQLValueString($_POST['1'], "int"),
GetSQLValueString($_POST['2'], "int"),
GetSQLValueString($_POST['3'], "int"),
GetSQLValueString($_POST['4'], "int"),
GetSQLValueString($_POST['5'], "int"),
GetSQLValueString($_POST['id'], "int"));
mysql_select_db($database_con_quiz, $con_quiz);
$Result1 = mysql_query($updateSQL, $con_quiz) or die(mysql_error());
//SET ID to ID +1
$id2=($id+1);
$updateGoTo = "question.phpi?d=".$id2."";
if (isset($_SERVER['QUERY_STRING'])) {
$updateGoTo .= (strpos($updateGoTo, '?')) ? "&" : "?";
$updateGoTo .= $_SERVER['QUERY_STRING'];}
header(sprintf("Location: %s", $updateGoTo));