I'm a beginner in PHP development, I'm learning PHP this year in computer school, and I have to develop a site for the end of next week, problem is that I'm really struggling. Since I'm a beginner...
So, it's a registration thing, and when I register it tells me there's a problem with bind_param...
here are my codes:
<?php
$conn = new mysqli("localhost","user","password","database");
if(!$conn){
echo 'Erreur de connexion: ' . mysqli_connect_error();
}
require 'database.php';
$message = '';
if (!empty($_POST['email']) && !empty($_POST['password'])) {
$mysqli = "INSERT INTO users (email, password) VALUES (:email, :password)";
$stmt = $conn->prepare($mysqli);
$stmt->bind_param(':email', $_POST['email']);
$password = password_hash($_POST['password'], PASSWORD_BCRYPT);
$stmt->bind_param(':password', $password);
if ($stmt->execute()) {
$message = 'Félicitation, vous avez réussi à créer un nouvel utilisateur.';
} else {
$message = 'Désolé, un compte a déjà été créé avec la même adresse mail.';
}
}
?>
I'm really a beginner, so please bear with me, because I don't want to miss my homework because of a problem with BIND_PARAM.
I'm using MariaDB as a database, I don't know if it helps if I say what I'm using as a database.