$q = "INSERT INTO customers (username, email, pass, first_name, last_name) VALUES ('$u', '$e','" . password_hash($p, PASSWORD_BCRYPT) . "', '$fn', '$ln)";
$r = mysqli_query($dbc, $q);
客户表的结构。
id int(10) UNSIGNED AUTO_INCREMENT
username varchar(45)
email index varchar(80)
first_name varchar(20)
last_name varchar(40)
pass varchar(255)
date_created timestamp CURRENT_TIMESTAMP
type enum('member', 'administer')
然后,mysqli_affected_rows($dbc)
返回-1。
告诉我什么是问题。
答案 0 :(得分:-1)
在插入的最后一个值中,您错过了一个'。
$q = "INSERT INTO customers (username, email, pass, first_name, last_name) VALUES ('$u', '$e','" . password_hash($p, PASSWORD_BCRYPT) . "', '$fn', '$ln)";
尝试使用此
$q = "INSERT INTO customers (username, email, pass, first_name, last_name) VALUES ('$u', '$e','" . password_hash($p, PASSWORD_BCRYPT) . "', '$fn', '$ln')";