nl2br not working for mySQL result
Posted: Thu Oct 13, 2005 4:38 pm
I'm trying to get the content of an article from a mySQL (that part works,) however when I try to use nl2br with the string returned from mysql_result it doesn't work.
Here is the code by the way:
It does print the content of the article, but instead of creating a newline, it just prints \n as it is stored in the database. Any suggestions?
Burrito: Please use
Here is the code by the way:
Code: Select all
<?php
$sql = 'SELECT `article_content` '
. ' FROM `articles` '
. ' WHERE 1 AND `article_id` ='
. $id . ' LIMIT 0, 30';
$result = mysql_query($sql,$db);
$content = mysql_result($result,0,"article_content");
echo nl2br($content);
mysql_close($db);
?>Burrito: Please use
Code: Select all
tags when [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting PHP Code In The Forums[/url][/size]