title: Update a row but before updating, input box should met a record
body: <p>The following always echoes <code>'success'</code> even if <code>mname</code> is not found. If it's not found, it should show <code>'failed'</code>. Why is it showing <code>'success'</code> when I enter an <code>mname</code> that isn't found?</p>
  
  <pre><code>&lt;?php 
  $conn = mysqli_connect("localhost","root","","lpdb"); 
  
  //update 
  if (isset($_POST['forgot'])){ 
      $password = 'password'; 
      $mname = $_POST['mname']; 
      $query = "UPDATE logindb SET password ='$mname' WHERE mname = '$mname'"; 
      $result = mysqli_query($conn, $query); 
      if ($result) { 
          echo 'success'; 
      } else { 
          echo 'failed'; 
      } 
  }
  ?&gt;
  </code></pre>