I have a result in the database like this
[border color=#EEE]
[pictitle]Title of your picture[/pictitle]
[image]http://tingle.fm/wiki/assets/images/default-thumb.gif[/image]
[line color=#D4D4D4][/line]
[/border]
And for some reason when I output the text it shows like this:
[border color=#EEE]
[pictitle]Title of your picture[/pictitle]
[image]http://tingle.fm/wiki/assets/images/default-thumb.gif[/image]
gif[/image]
[line color=#D4D4D4][/line]
[/border]
The code I use is this:
<?php
$query = mysql_query("SELECT FROM wiki WHERE id='1'");
$assoc = mysql_fetch_assoc($query);
echo nl2br($assoc['content']);
?>
Is there any way I can output the text as raw please so it indents? Much appreciated!
If this is the output on your page, then make sure you can see those spaces/tabs also in the source code. If you can, then you can use str_replace
to replace those white characters with something that will be also visible on the page
// Replacing white space characters with HTML entities
$replacedSpaces = str_replace("
", "
", $assoc['content']);
// Replacing new line characters with <br> and printing it out
echo nl2br($replacedSpaces);