This question already has an answer here:
- Hash Password in PDO Error/Notice 1 answer
<?php
require 'database.php';
if (isset($_POST['email']) && isset($_POST['password'])):
// Enter the new user in the database
$sql = "INSERT INTO users (email, password) VALUES (:email, :password)";
$stmt = $conn->prepare($sql);
$stmt->bindParam(':email', $_POST['email']);
$stmt->bindParam(':password', password_hash($_POST['password'], PASSWORD_BCRYPT));
if( $stmt->execute() ):
die('Success');
else:
die('Fail');
endif;
endif;
?>
It successfully add the user and password in the database but it gives the error below
Only variables should be passed by reference in C:\xampp\htdocs\authegister.php on line 12
</div>