学习WAMP,做一个PHP+MYSQL的简单的图书管理系统,实现增删改查功能,做到增就遇到问题

如题,不能在页面中向数据库添加数据

数据库连接没问题
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']);}
$Result1 = mysql_query($insertSQL, $conn) or die( mysql_error( ) );
if(isset($_SERVER['QUERY_STRING'])){
$insertGoTo .= (strpos($insertGoTo,'?')) ? "&" :"?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s",$insertGoTo));
}
mysql_select_db($database_conn,$conn);
$query_Book ="SELECT * FROM booktable";
$Book = mysql_query($query_Book,$conn) or die (mysql_error());
$row_Book =mysql_fetch_assoc($Book);
$totalRows_Book = mysql_num_rows($Book);
?>

肯定有个什么地方少个括号,或者少了分号。

if(isset($_SERVER['QUERY_STRING'])){
        $insertGoTo .= (strpos($insertGoTo,'?')) ? "&" :"?";
        $insertGoTo .= $_SERVER['QUERY_STRING'];
    }
    header(sprintf("Location: %s",$insertGoTo));
}

这里是不是最后多了一个大括号

温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-05-30
拼写错误 ,少个括号什么的,细心点就好
第2个回答  2013-05-31
少个括号,

WAMP可使用 Visual AMP 集成包追问

我来回检查了有10多遍了,不存在拼写错误跟少括号

相似回答