以下 mysqli 查询不执行,因为我检查了我的“用户”表并且它不包含任何记录:
//connection.php//
$db_connect = mysqli_connect('myremotehost', 'myremoteuser', 'mypass', 'mydatabase');
if(mysqli_connect_errno($db_connect)){
echo mysqli_connect_error();
exit();
}
//
include 'database/connection.php';
$username = $_POST['username'];
$password = md5($_POST['password']);
$email = $_POST['email'];
$email_code = md5($_POST['username'] + microtime());
$gender = $_POST['gender'];
$ip = getenv('REMOTE_ADDR');
$sql = "INSERT INTO `users` (username, password, email, email_code, gender, ip, signup, lastlogin, notescheck) VALUES('$username','$password','$email','$email_code','$gender','$ip',NOW(),NOW(),NOW())";
$query = mysqli_query($db_connect, $sql);
//below are the forms with their respective 'input names' that are equal to: username, email and gender (values 'm' & 'f').
//The action of the actual form is action="" this file.
我知道这段代码是直接在 $sql 和 $query 变量下面执行的问题是查询没有在数据库上发布任何内容。
有什么建议么?
多谢你们!