php - mysql, display text format when echoing out content? -


i trying echo out text stored in mysql table, text in column 'content' formated, i.e. has breaks.

for reason when echo out text text displaying 1 continious result , want keep text format/breaks when echoing out, there way can this?

table:

id  |  user  |      content   1        5          hello,                     hows today?   2        4          text 

php

<?php $message_set = read_message(); while ($message = mysql_fetch_array($message_set)) {   <div class="message_content"> <? echo "{$message['content']}"; ?> </div> 

css

.message_content{     margin-left:90px;     padding-top:9px;     padding-right:15px;     padding-bottom:20px; } 

the text displaying 1 continious result, because that's way how line breaks treated in html default php sends output html browser default. have either

  • convert line breaks html <br> tags (e.g. using nl2br()), or
  • use css style <div> in such way line breaks in html displayed line breaks in browser (using white-space: pre rule), or
  • wrap query result in <pre> tags.

Comments

Popular posts from this blog

android - getbluetoothservice() called with no bluetoothmanagercallback -

sql - ASP.NET SqlDataSource, like on SelectCommand -

ios - Undefined symbols for architecture armv7: "_OBJC_CLASS_$_SSZipArchive" -