无法将值插入表中

时间:2016-10-03 19:25:07

标签: php mysql

我正在尝试将值从注册表单插入数据库,但我不断收到消息“用户注册失败”,我不知道原因。

<?php
include("home.html");
require('connect.php');
if (isset($_POST['username']) && isset($_POST['password'])){
    $username = $_POST['username'];
    $email = $_POST['email'];
    $password = $_POST['password'];

    $query = "INSERT INTO users (username, password, email) VALUES ('$username', '$password', '$email')";
    $result = mysqli_query($connection, $query);
    if($result)
    {
        $smsg = "User Created Successfully";
    }
    else
    {
        $fmsg ="User Registration Failed";
    }
}

0 个答案:

没有答案