mysql插入中的小错误

时间:2017-10-01 09:02:59

标签: php mysql

即时尝试执行插入查询,而脚本在phpmyadmin db中完美运行时,信息不会出现。

<?php

session_start();
include 'host.php';
$link = mysqli_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PWD, MYSQL_DB);
if (isset($_REQUEST['token']) && $_REQUEST['token'] == $_SESSION['formFlager3'] && isset($_REQUEST['name']) && isset($_REQUEST['email']) && isset($_REQUEST['password']) && isset($_REQUEST['confirm'])) {
$name = mysqli_real_escape_string($link, $_REQUEST['name']);
$email = mysqli_real_escape_string($link, $_REQUEST['email']);
$pass = mysqli_real_escape_string($link, $_REQUEST['password']);
$pass = password_hash($pass, PASSWORD_BCRYPT);
$sql = "INSERT INTO users VALUES ('',$name,$email,$pass)";
$in = mysqli_query($link, $sql);
}

?>

这是host.php

<?php

define("MYSQL_HOST", "localhost");
define("MYSQL_USER", "root");
define("MYSQL_PWD", "");
define("MYSQL_DB", "friend");

0 个答案:

没有答案