title: Removing newlines in PHP - but they still show in LONGTEXT in MySQL
body: <p>Ello chaps.</p>
  
  <p>Ok - cleaning my string like this:</p>
  
  <pre><code>$clean_string = preg_replace("/[\n\r]/"," ",trim($dirty_string));
  </code></pre>
  
  <p>.. Echo it out to the screen and it works - one lovely big lump of text with no newlines.</p>
  
  <p>INSERT it into a LONGTEXT type field in MySQL - then preview the resulting data in Sequel Pro - and for some reason it has new lines. Loads of them, just like it did when it was new, before I cleaned it. </p>
  
  <p>What am I doing wrong? Is it LONGTEXT? </p>
  
  <hr>
  
  <p>This is what the html source looks like when I use the content of a SO page as a the string - note the many spaces and newlines - even when cleaned!</p>
  
  <pre><code>    mysql - Trouble with CONCAT and Longtext - Stack Overflow
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
  
                  Stack Exchange
  </code></pre>