title: MYSQL/PHP selecting
body: <p>I have 2 tables :</p>
  
  <ul>
  <li><p><code>newpw_ask</code></p>
  
  <pre><code>email
  code
  </code></pre></li>
  <li><p><code>users</code></p>
  
  <pre><code>id
  username
  password
  email
  sid
  newpw_code
  </code></pre></li>
  </ul>
  
  <p>I have this PHP code:</p>
  
  <pre><code>$code = $_POST['code2'];
  $email = mysql_query("SELECT email FROM pw_ask WHERE code='$code'");
  
  if ($pass == $pass2) {
      if ($email) {
          $pass3 = md5($pass);
  
          mysql_query("UPDATE users SET password='$pass3' WHERE email='$email'");
          mysql_query("UPDATE users SET newpw_code='' WHERE email='$email'");
          mysql_query("DELETE FROM pw_ask WHERE code='$code'");
  
          header("Location: index.php?ret=pw");
      } else {
          echo 'Wrong code';
      }
  }
  </code></pre>
  
  <p>Only this query got executed:</p>
  
  <pre><code>mysql_query("DELETE FROM pw_ask WHERE code='$code'");
  </code></pre>
  
  <p>Also when I enter the right code, it says “Wrong code”.</p>