title: Cannot delete MySQL record using PHP
body: <p>Sorry for the badly phrased title, I don't know what else to call this situation.</p>
  
  <p>Here's my dilemma, for fun I'm making a little doodad so people can submit the name, platform, and location of Battlefield 3 servers so they no longer need to rely on word of mouth.</p>
  
  <p>This older code works fine, it deletes records and does it's job.</p>
  
  <pre><code>&lt;?php
  
  mysql_connect('localhost', 'root', 'pass');
  mysql_select_db('database');
  
  $server_secret = mysql_real_escape_string($_POST['secret_initial']);
  $server_confirm = mysql_real_escape_string($_POST['secret_verify']);
  
  if ($server_secret == $server_confirm) {
      echo "Both matched.";
      if ((strlen($server_secret) &lt; 6) and (strlen($server_verify) &lt; 6)) {
          echo "Password too short.";
      } else {
          echo "Password is of proper length.";
          $sql = "DELETE FROM `servers` WHERE secret='" . sha1($server_secret) . "'";
          mysql_query($sql) or die("Couldn't delete record. " . mysql_error());
      }
  } else {
      echo "Mismatch.";
  }
  
  ?&gt;
  </code></pre>
  
  <p>However, if I use this:</p>
  
  <pre><code>&lt;?php
  
  mysql_connect('localhost', 'root', 'pass');
  mysql_select_db('database');
  
  // Create variables from form
  $server_secret = mysql_real_escape_string($_POST['secret_initial']);
  $server_confirm = mysql_real_escape_string($_POST['secret_verify']);
  
  // Check for verification
  if ($server_secret == $server_confirm) {
      // Delete from database
      $sql = "DELETE FROM `servers` WHERE secret='" . sha1($server_secret) . "'";
      if (mysql_query($sql) or die("Couldn't delete record. " . mysql_error()) {
          $success = true;
      } else {
          $success = false;
      }
  }
  
  ?&gt;
  </code></pre>
  
  <p>It always reports $success as true, even when it is false, and what also confuses me is even when both the secret and verification are correct the entry isn't removed from the MySQL database.</p>
  
  <p>The older version works fine though. That's what baffles me.</p>
  
  <p>The same method I used for checking success (<code>if (mysql_query($sql)</code>) worked fine for insertion and actually gives me feedback if it fails as it should, but for some reason it always reports success when I attempt to delete a record.</p>
  
  <p>If anyone can help me out here I'd really appreciate it.</p>
  
  <p>Please note: I'm very much a novice with PHP/MySQL, so please forgive me.</p>