我想在此代码中添加出生日期,性别和位置选项,此代码也有一些错误,并且还希望加密我的密码任何身体帮助
<?php
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "mydb";
// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if(isset($_POST['register-user']))
{
$name = $_POST['username'];
$email = $_POST['email'];
$password = $_POST['password'];
$gender = $_POST['gender'];
$date_of_birth = $_POST['$year'.'$day'.'$month'];
$stmt = mysqli_prepare($conn, "INSERT INTO
mydata(name,email,Password,Gender,Country,Language) VALUES (?, ?, ?)");
mysqli_stmt_bind_param($stmt, "sss", $name,
$email,$date_of_birth,$gender);
mysqli_stmt_execute($stmt);
}
?>
答案 0 :(得分:0)
更改
$date_of_birth = $_POST['$year'.'$day'.'$month'];
要
$date_of_birth = $_POST['year']."-". $_POST['month']."-".$_POST['day'];
使用MD5进行密码加密
$encryptedPassword=MD5($_POST['password'])