title: MySQL real escape string
body: <p>I was trying to sanitize inputs to my PHP login using addslashes and mysql_real_escape_string.  Using <code>addslashes</code> works, but <code>mysql_real_escape_string</code> will not.</p>
  
  <p>Here's an example of what allows me to log in correctly:</p>
  
  <pre><code>$user = addslashes($_POST['user']);&lt;br/&gt;
  $password = addslashes($_POST['password']);
  </code></pre>
  
  <p>And this will not:</p>
  
  <pre><code>$user = mysql_real_escape_string($_POST['user']);&lt;br/&gt;
  $password = mysql_real_escape_string($_POST['password']);
  </code></pre>
  
  <p>Also, some of my other fields contain apostrophes. Nothing is returned when using addslashes, since the entry in the DB isn't escaped.  I was wondering if using <code>mysql_real_escape_string</code> could fix this, but I don't know how.</p>