带有PHP错误的注册表
所以我的问题是PHP中的注册表。 当我为输入类型设置一个类时,例如:带有PHP错误的注册表,php,jquery,mysql,forms,jquery-ui,Php,Jquery,Mysql,Forms,Jquery Ui,所以我的问题是PHP中的注册表。 当我为输入类型设置一个类时,例如:发生了一个错误 列“username”不能为空 列“paswword”不能为空 “电子邮件”列不能为空 Index.php源代码 <?php require_once('Connections/Lidha_me_DB.php'); ?> <?php if (!function_exists("GetSQLValueString")) { function GetSQLValueStr
发生了一个错误
列“username”不能为空
列“paswword”不能为空
“电子邮件”列不能为空
Index.php源代码
<?php require_once('Connections/Lidha_me_DB.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"] == "login-1")) {
$insertSQL = sprintf("INSERT INTO punekerkues (username, password, email) VALUES (%s, %s, %s)",
GetSQLValueString($_POST['username'], "text"),
GetSQLValueString($_POST['password'], "text"),
GetSQLValueString($_POST['email'], "text"));
mysql_select_db($database_Lidha_me_DB, $Lidha_me_DB);
$Result1 = mysql_query($insertSQL, $Lidha_me_DB) or die(mysql_error());
$insertGoTo = "jobs.html";
if (isset($_SERVER['QUERY_STRING'])) {
$insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
$insertGoTo .= $_SERVER['QUERY_STRING'];
}
header(sprintf("Location: %s", $insertGoTo));
}
mysql_select_db($database_Lidha_me_DB, $Lidha_me_DB);
$query_Register = "SELECT username, password, email FROM punekerkues";
$Register = mysql_query($query_Register, $Lidha_me_DB) or die(mysql_error());
$row_Register = mysql_fetch_assoc($Register);
$totalRows_Register = mysql_num_rows($Register);
?>
<!DOCTYPE html>
<html class="no-js">
<head>
<link href="css/bootstrap.css" rel="stylesheet">
<link href="css/bootstrap-responsive.css" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/reset.css"/>
<link rel="stylesheet" type="text/css" href="css/style.css"/>
<link rel="stylesheet" type="text/css" href="css/jquery.combosex.css"/>
<script type="text/javascript" src="js/jquery.1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui.1.7.2.min.js"></script>
<script type="text/javascript" src="js/jquery.combosex.min.js"></script>
<script type="text/javascript" src="js/jquery.easytabs.min.js"></script>
<script type="text/javascript" src="js/jquery.scrollbar.min.js"></script>
<script type="text/javascript" src="js/custom.js"></script>
</head>
<body>
<form id="login-1" action="<?php echo $editFormAction; ?>" method="post" >
<input type="text" name="username" value="" placeholder="Username" class="textfield"/>
<input type="password" name="password" value="" placeholder="Password" class="textfield"/>
<input type="text" name="email" value="" placeholder="Email" class="textfield"/>
<input type="submit" value="Register" />
<input type="hidden" name="MM_insert" value="login-1" />
</form>
</body>
</html>
<?php
mysql_free_result($Register);
?>
这是一个mysql错误,您应该填写此列,或者将数据库更改为:
MODIFY COLUMN `username` varchar(16) DEFAULT
不要使用PHP\u VERSION<6
使用PHP\u VERSION\u ID<50400
如果我删除了code class=“textfield”,请正确提交表单,然后请调试它并提供信息。我认为您需要使用var_dump($_请求)来查看此变量中是否有“username”。谢谢你的回复。我是PHP的begginer,所以我不知道如何调试。我附上一个项目来源的链接,所以如果你有时间看看,我将不胜感激。