学习WAMP,做一个PHP+MYSQL的简单的图书管理系统,实现增删改查功能,做到增就遇到问题
如题,不能在页面中向数据库添加数据数据库连接没问题functionGetSQLValueString($theValue,$theType,$theDefinedValu...
如题,不能在页面中向数据库添加数据
数据库连接没问题
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);
?> 展开
数据库连接没问题
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);
?> 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询