I have
$salt = md5(mt_rand());
$hashed = hash_hmac('SHA256', $password, $salt);
$stmt = self::$_dbh->prepare('INSERT INTO users (username, password, salt, display, email) VALUES (:username, :password, :salt, :display, :email)');
$stmt->bindParam('username', $username);
$stmt->bindParam('password', $hashed);
$stmt->bindParam('salt', $salt);
$stmt->bindParam('display', $display);
$stmt->bindParam('email', $email);
$stmt->execute();
$firephp->log('Insert OK ');
if ($stmt->rowCount() > 0) {
return array(
'status' => 'OK',
'message' => 'Registration Successful'
);
}
$firephp->log('Unknown ... Row count: ' . $stmt->rowCount());
return array(
'status' => 'failed',
'message' => 'Something went wrong with the registration ... Please try again ...'
);
I always gets “Something went wrong with the registration … Please try again …”. It appears rowCount is 0. True enough, it does not insert into database. Why is that?
Try: