Update query is not reflected into database . This is related to PHP and PDO method of connection. The query I have written is ,
try {
  $conn = new PDO('mysql:host=localhost;dbname=***; charset=utf8','root','****[enter image description here][1]');
  $conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  $sql = "SELECT * FROM providers WHERE password = '$oldpass'";
  $statement = $conn->prepare($sql);  
  $statement->execute();  
  $providers = $statement->fetchAll();
  
  if(($providers[0]["password"]=="$oldpass") and ("$pass"=="$cpass")){
    
    $statement = $conn->prepare('update providers set password="$cpass" where password="$oldpass"');  
    $condition=$statement->execute();
    
    echo '<script>alert("Password changed")</script>';
  }
  else{
    echo '<script>alert("Incorrect old password");</script>';
  }
        }
        catch(PDOException $e) {
            echo "Connection failed: " . $e->getMessage();
        }
            $conn = null;
        }
EDIT The message on entering corresponding credentials is Password changed.
Is there anything wrong with the query?? Because it does not show the updated password in database (phpMyAdmin)
 
    