This question already has an answer here:
I am trying this code:
public function storeUser($name, $email, $password, $Preference) {
$uuid = uniqid('', true);
$hash = $this->hashSSHA($password);
$encrypted_password = $hash["encrypted"]; // encrypted password
$salt = $hash["salt"]; // salt
echo $Preference;
$stmt = $this->conn->prepare("INSERT INTO users(unique_id, name, email, encrypted_password, salt, created_at, Preference) VALUES(?, ?, ?, ?, ?, NOW(), ?)");
$stmt->bind_param("sssss", $uuid, $name, $email, $encrypted_password, $salt, $Preference);
$result = $stmt->execute();
$stmt->close();
and the above code is giving the following error:
Warning: mysqli_stmt::bind_param(): Number of elements in type definition string doesn't match number of bind variables in /storage/ssd4/329/3219329/public_html/include/DB_Function.php on line 34 {"error":true,"error_msg":"Unknown error occurred in registration!"}
and line no 34 is:
$stmt->bind_param("sssss", $uuid, $name, $email, $encrypted_password, $salt, $Preference);
The following code is working perfectly:
public function storeUser($name, $email, $password) {
$uuid = uniqid('', true);
$hash = $this->hashSSHA($password);
$encrypted_password = $hash["encrypted"]; // encrypted password
$salt = $hash["salt"]; // salt
$stmt = $this->conn->prepare("INSERT INTO users(unique_id, name, email, encrypted_password, salt, created_at) VALUES(?, ?, ?, ?, ?, NOW())");
$stmt->bind_param("sssss", $uuid, $name, $email, $encrypted_password, $salt);
$result = $stmt->execute();
$stmt->close();
Please help me.
Thank you.
</div>