Here is my code:
$conn = new mysqli(DB_HOST, DB_USER, DB_PASS, DB_NAME);
if ($conn->connect_error) {
die('Database error:' . $conn->connect_error);
}
$sql = "INSERT INTO users (username, email, verified, token, password) VALUES (?, ?, ?, ?, ?)";
$stmt = $conn->prepare($sql);
$stmt->bind_param('ssbss', $username, $email, $verified, $token, $password);
if ($stmt->execute()) {
//login user
} else {
$errors['db_error'] = "Database error: Failed to register";
}
The output when I enter good inputs, it print in the error area: Database error: Failed to register
Also, I defined the variables: DB_HOST, DB_USER, DB_PASS, DB_NAME
the same as in my Xampp phpmyadmin settings.
If you need more info just tell me and i'll try my best give it to you.