title: MD5 acting different in SQL database and in PHP script
body: <p>Recently I have created a script that handles login and register for my Game that uses http_get method to update stats. I have managed to create everything successfully, but there is a problem. When a user registers, it inserts different md5 string that PHP scripts generated and because of this, I cannot compare passwords.</p>
  
  <p>This is the way I insert md5 string into a database:</p>
  
  <pre><code>$pw = md5($password);
      $insert = mysqli_query($connect, "INSERT INTO Accounts (username, password, email,reg_ip, wins, looses, experience) VALUES ('$username', '$pw', '$email',  '$reg_ip', '0','0', '0')");
      if($insert) {
              echo "account successfully created"; 
  
          } 
          else {
              echo "error";
          }
  </code></pre>
  
  <p>And this is the way I check for passwords:</p>
  
  <pre><code>if($p['password'] == md5($password)) {
                  echo "login was successful!";
              }
              else {
                  echo "incorrect password";
              }
  </code></pre>
  
  <p>This is the md5 string that is in the database when user registers: (un-encrypted string is: pocakaj123)</p>
  
  <pre><code>54e8850ba5eca655854ddf1b503943
  </code></pre>
  
  <p>and this is the generated string when I <code>echo md5($password)</code>.</p>
  
  <pre><code>54e8850ba5eca655854ddf1b50394348
  </code></pre>