Ello chaps.
Ok - cleaning my string like this:
$clean_string = preg_replace("/[\n\r]/"," ",trim($dirty_string));
.. Echo it out to the screen and it works - one lovely big lump of text with no newlines.
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.
What am I doing wrong? Is it LONGTEXT?
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!
mysql - Trouble with CONCAT and Longtext - Stack Overflow
Stack Exchange