PHPMYADMIN中的用户注册表未存储任何添加的数据

时间:2014-12-02 10:37:11

标签: php mysql dreamweaver

我是phpmyadmin和sql的新手!我使用SecureWamp通过dreamweaver CC创建了数据库连接。它全部连接到我的表等,但无论我在“用户注册”表单中输入多少次信息,都没有信息显示在phpmyadmin中。这是我的代码: 本地主机代码:

<?php
# FileName="Connection_php_mysql.htm"
# Type="MYSQL"
# HTTP="true"
$hostname_localhost = "localhost";
$database_localhost = "XXXXX";
$username_localhost = "XXXXX";
$password_localhost = "XXXXX";
$localhost = mysql_pconnect($hostname_localhost, $username_localhost, $password_localhost) or trigger_error(mysql_error(),E_USER_ERROR); 
?>

这是我的实际用户注册表单页面上的代码:

<?php require_once('Connections/localhost.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"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO usersregistration (FirstName, LastName, Email, Password) VALUES (%s, %s, %s, %s)",
                       GetSQLValueString($_POST['FirstName'], "text"),
                       GetSQLValueString($_POST['LastName'], "text"),
                       GetSQLValueString($_POST['email'], "text"),
                       GetSQLValueString($_POST['password'], "text"));

  mysql_select_db($database_localhost, $localhost);
  $Result1 = mysql_query($insertSQL, $localhost) or die(mysql_error());

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

mysql_select_db($database_localhost, $localhost);
$query_Recordset1 = "SELECT * FROM usersregistration";
$Recordset1 = mysql_query($query_Recordset1, $localhost) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
$query_Recordset1 = "SELECT * FROM usersregistration";
$Recordset1 = mysql_query($query_Recordset1, $localhost) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>

有没有人可以分享他们的智慧并告诉我为什么没有任何内容插入PHPmyadmin以及如何更改它以便存储信息!

谢谢!! :)

**这是我的表格:

<p>
<form id="form1" name="form1" method="POST" action="<?php echo $editFormAction; ?>">
  <table width="600" border="0" cellspacing="3">
    <tbody>
      <tr>
        <td><label for="FirstName">First Name </label>
        <input name="FirstName" type="text" required="required" id="FirstName" form="form1" title="FirstName" /></td>
      </tr>
      <tr>
        <td>Last Name 
          <input name="LastName" type="text" required="required" id="LastName" form="form1" title="LastName" /></td>
      </tr>
      <tr>
        <td><label for="email">Email:</label>
        <input name="email" type="email" required="required" id="email" form="form1" title="Email" /></td>
      </tr>
      <tr>
        <td><label for="password">Password:</label>
        <input name="password" type="password" required="required" id="password" form="form1" title="Password" /></td>
      </tr>
      <tr>
        <td>&nbsp;</td>
      </tr>
      <tr>
        <td><a href="Login.php" title="Register">Register</a></td>
      </tr>
    </tbody>
  </table>
  <input type="hidden" name="MM_insert" value="form1" />
</form>

0 个答案:

没有答案