<?php
ini_set('display_errors',1);
ini_set('display_startup_errors',1);
error_reporting(-1);
if (isset($_POST['submit'])) {
$passport = substr(str_shuffle("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, 20);
$link = mysqli_connect("localhost","php","","A");
$query = "INSERT INTO users (nickname, passport, mail, password, age, sex, is_registered)
VALUES ('$_POST[nickname]', '$passport', '$_POST[mail]', md5('$_POST[password]'), '$_POST[age]', '$_POST[sex]', '1')";
$result = $link->query($query);
}
?>
从passport
删除$passport
和$query
会让它再次发挥作用吗?
echo "$passport";
也有效。没有报告错误。
答案 0 :(得分:0)
试试这个,
md5($_POST['password'])
而不是
md5('$_POST[password]')
CODE:
$query = "INSERT INTO users (nickname, passport, mail, password, age, sex, is_registered)
VALUES ('$_POST[nickname]', '$passport', '$_POST[mail]', '".md5($_POST['password'])."', '$_POST[age]', '$_POST[sex]', '1')";