我遇到了问题,我的数据没有通过phpMyAdmin。服务器和数据库连接PHP,但数据未插入到表中。插入的数据不会去phpMyAdmin数据库
这是我到目前为止。
<?php
$dbConnect = mysqli_connect("xxxxxxx", "xxxxx","xxxxx");
if (!$dbConnect)
die("<p>The database server is not available.</p>");
echo "<p>Successfully connected to the database server.</p>";
$dbSelect = mysqli_select_db($dbConnect,"sxxxxxxx_db");
if (!$dbSelect)
die("<p>The database is not available.</p>");
echo "<p>Successfully opened the database.</p>";
$sql = "INSERT INTO customer (Name,Password,Email,Phone) VALUES ('$_POST[namefield]', '$_POST[pwdfield]','$_POST[email]','$_POST[phone]') ";
mysqli_query($sql,$dbConnect);
mysqli_close($dbConnect);
if(isset($_POST['namefield']) && isset($_POST['pwdfield']) && isset($_POST['cpwdfield']) && isset($_POST['email']) && isset($_POST['phone']) && isset($_POST['submit']))
{
$name = $_POST['namefield'];
$password = $_POST['pwdfield'];
$cpassword = $_POST['cpwdfield'];
$email = $_POST['email'];
$phone = $_POST['phone'];
if ($_POST["pwdfield"] == $_POST["cpassword"])
mysqli_query("INSERT INTO user VALUES('','$password')") or die(mysqli_error());
else {
echo("Password did not match! Try again. ");
删除mysqli_close($数据库连接);这一行,并把它放在else块的末尾 – RaMeSh 2015-04-06 07:22:09