title: mysql_real_escape_string & slashes
body: <p>Firstly magic quotes &amp; runtime are disabled correctly in <code>php.ini</code>, and confirmed by <code>phpinfo()</code>.</p>
  
  <pre><code>PHP version: 5.3.4
  MySQL version: 5.1.52
  </code></pre>
  
  <p>I'm only using <code>mysql_real_escape_string</code> on the data, after <code>htmlspecialchars</code> and a <code>trim</code>, that's all the data cleaning on the variable.</p>
  
  <p>Yet, when I submit a single quote, the slash remains in the database.</p>
  
  <p>When running <code>mysql_query</code> I'm using <code>"' . $var . '"</code>, although in the past this hasn't changed anything (could be due to the double quotes?).</p>
  
  <p>Any ideas? and please don't tell me about PDO/prepared statements, I'm aware of them and I have my reasons for doing it this way.</p>
  
  <p>Thanks!</p>
  
  <p>Code example (this is the only thing done to the data):</p>
  
  <pre><code>mysql_real_escape_string( htmlspecialchars( trim( $data ) ) );
  </code></pre>