I try to avoid asking stupid questions, but this for some reason is just not working. I'm retrieving some text from a database, with newlines included. When using echo straight away, this is the output:
=== BOLD TEXT ===\nHere is some text.
This is how i retrieved it:
$row = $query->row();
$content=$row->course_content;
Neither of the following have any effect.....
$content= str_replace(array("\r\n", "\r", "\n"), "<br />", $content);
$content= str_replace("\n", " ", $content);
$content = nl2br($content);
HOWEVER, when i hard code it in a string to the original statement,
$content="=== BOLD TEXT ===\nHere is some text.";
pang! it works... any ideas as to why it refuses to accept the database input, but is fine with the manual string?
Complete Code:
//Switch between these two:
$row = $query->row();
$content=$row->course_content;
$content="=== BOLD TEXT ===\nHere is some text.";
$content = str_replace(array("\r\n", "\r", "\n"), "<br />", $content);
$content = str_replace("\n", " ", $content);
$content = nl2br($content);
echo $content;