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