brem13 Posted March 31, 2009 Share Posted March 31, 2009 i got a simple blog page on my site and if someone enters a blog and they write it in this format... hey, this is a blog. it will all show up properly in the database when i look at it, but when its called back to be viewed on the page, it shows up like this hey,thisisablog. here is the code i use to call it back... mysql_connect($server, $db_user, $db_pass) or die (mysql_error()); $result = mysql_db_query($database, "select * from $table WHERE id = '$id'") or die (mysql_error()); while ($qry = mysql_fetch_array($result)) { echo '<font face=tahoma size=2><strong>'; echo $qry[name]; echo '</strong><br><hr align=left width=200px>'; echo $qry[message]; echo '</font><br><br>'; echo '<font face=tahoma size=1><strong>Date Created:</strong> '.$qry[date_created].' - <strong>Date Modified:</strong> '.$qry[date_modified]; Link to comment https://forums.phpfreaks.com/topic/151940-solved-calling-data-from-database-doesnt-include-line-breaks/ Share on other sites More sharing options...
Ayon Posted March 31, 2009 Share Posted March 31, 2009 try this str_replace("\n","<br />\n",$qry[message]); Link to comment https://forums.phpfreaks.com/topic/151940-solved-calling-data-from-database-doesnt-include-line-breaks/#findComment-797890 Share on other sites More sharing options...
lonewolf217 Posted March 31, 2009 Share Posted March 31, 2009 i believe the function nl2br() will work for this to display properly Link to comment https://forums.phpfreaks.com/topic/151940-solved-calling-data-from-database-doesnt-include-line-breaks/#findComment-797891 Share on other sites More sharing options...
brem13 Posted March 31, 2009 Author Share Posted March 31, 2009 thank you very much Link to comment https://forums.phpfreaks.com/topic/151940-solved-calling-data-from-database-doesnt-include-line-breaks/#findComment-797904 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.