嗨你們可以幫我打破這個Dreamweaver中插入代碼嚮導特別的代碼if (!function_exists("GetSQLValueString")) { ....}
部分:解釋
<?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($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form")) {
$insertSQL = sprintf("INSERT INTO feedback (name, email, phone, service, message) VALUES (%s, %s, %s, %s, %s)",
GetSQLValueString($_POST['name'], "text"),
GetSQLValueString($_POST['email'], "text"),
GetSQLValueString($_POST['phone'], "text"),
GetSQLValueString($_POST['service'], "text"),
GetSQLValueString($_POST['message'], "text"));
mysql_select_db($database_kojexconsult, $kojexconsult);
$Result1 = mysql_query($insertSQL, $kojexconsult) or die(mysql_error());
$insertGoTo = "success.php";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
?>
沒有比[文檔](http://php.net/)更好的地方開始了,特別是['function_exists'](http://us3.php。net/function_exists) –
tereško,我知道你的評論籠罩在諷刺中,但我仍然不知道你爲什麼決定和我一起去南方。同樣,謝謝 –