<?php
$servername = "localhost";
$username = "root";
$password = "";
$db = "youtube";
$conn = new mysqli($servername, $username, $password, $db);
// Check connection
//if ($conn->connect_error) {
// die("Connection failed: " . $conn->connect_error);
//}
//echo "Connected successfull
if(isset($_POST['Submit']))
{
if(mysqli_num_rows(mysqli_query($conn," INSERT INTO admin where
Name='".$_POST['Name']."' , Password='".$_POST['Password']."', E-
mail='".$_POST['E-mail']."' and country='".$_POST['country']."'"))>0)
{
echo 'signup successfull';
}
else
{
echo 'incorrect username password';
}
}
?>
Welcome <?php echo $_POST["name"]; ?><br>
Your email address is: <?php echo $_POST["email"]; ?>
<?php echo "<br>"?>
Your country is: <?php echo $_POST["country"]; ?>
<?php echo "<br>"?>
Your password is: <?php echo $_POST["pwd"]; ?>
<?php echo "<br>"?>
答案 0 :(得分:0)
数据插入查询中的问题。
$sql = "INSERT INTO admin(name, Password, mail,country)
VALUES ("$_POST['Name']", "$_POST['Password']", "$_POST['E-mail']","$_POST['country']")";
if (mysqli_query($conn, $sql)) {
echo "New record created successfully";
} else {
echo "Error: " . $sql . "<br>" . mysqli_error($conn);
}
尝试