When I try to put a new user's password into a MySQL database, it doesn't encrypt it correctly. Here's the code I'm using:
$encPassword = hash('sha256', $_POST['password']);
$query = sprintf("INSERT INTO users(`userName`,`email`,`password`)
VALUES('%s','%s',PASSWORD('%s'))",
mysql_real_escape_string($_POST['userName']),
mysql_real_escape_string($_POST['email']),
mysql_real_escape_string($encPassword))or die(mysql_error());
$sql = mysql_query($query);
When I check the database though, it doesn't store the password as sha256 encrypted. It only has 16 random characters (it should have ~50). What's wrong with it?