-4

I am getting the error Strict standards: Only variables should be passed by reference on line 14

<?php
require 'database.php';
$messaqage = '';

if(!empty($_POST['email']) && !empty($_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() ):
        $message = 'Successfully created new user';
    else:
        $message = 'Sorry there must be an issue creating your account';
    endif;

endif;

?>

I am stuck in resolving this error. I am not able to debug the issue.

Thanks in advance

Agam Banga
  • 2,708
  • 1
  • 11
  • 18
vernon
  • 1
  • 1
  • 1
    You can't consider this a question, it's a bunch of code being displayed here. Please add some explanation. – Tobias F. May 04 '17 at 09:47
  • $password = password_hash($_POST['password'],PASSWORD_BCRYPT); $stmt->bindParam(':password',$password); – JYoThI May 04 '17 at 09:47

1 Answers1

0

bindParam() second argument is a reference. You pass a function result. change like this .

$password = password_hash($_POST['password'],PASSWORD_BCRYPT); 
$stmt->bindParam(':password',$password); 
JYoThI
  • 11,977
  • 1
  • 11
  • 26