I have some method to save record including user token and email like this:
public function saveResetToken($email, $resetToken)
{
try {
$conn = Database::getConnection();
// Connect and create the PDO object
$conn->exec('SET CHARACTER SET utf8'); // Sets encoding UTF-8
// Define and prepare an INSERT statement
$sql = 'UPDATE users SET reset_token=:token WHERE email =:email limit 1';
$stmt =$conn->prepare($sql);
// Adds value with bindParam
$stmt->bindParam(':email', $email, PDO::PARAM_STR);
$stmt->bindParam(':token', $resetToken,PDO::PARAM_STR );
if ($stmt->rowCount()===1){
$conn = null; // Disconnect
return true;
}else{
return false;
}
} catch (PDOException $e) {
include('../views/error.php');
include('../views/admin/includes/footer.php');
exit();
}
}
when i use print_r $stmt->rowCount() it return '1', but when check at my reset_token i find no data. so what wrong in my code?