Jump to content


Photo

Simple text formatting and MySQL


  • Please log in to reply
3 replies to this topic

#1 simonsays

simonsays
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 20 September 2006 - 11:59 AM

The problem is following. I have a column in MySQL of TEXT type. I put some text into it and the text consists of 2 paragrahs...
However, when I try to output a text with php-script the paragraphs are gone and text is output as a single paragrahp. Using html-tag <br> is not a good idea, as I use (strip_tags) function. Is there any solution?

Example (I input and would like to see as an output):
Sun is shining.
The weather is sweet.

Actually outputs:
Sun is shining. The weather is sweet.


#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 20 September 2006 - 01:31 PM

Look into to using the nl2br function.

#3 samshel

samshel
  • Members
  • PipPipPip
  • Advanced Member
  • 837 posts

Posted 20 September 2006 - 01:35 PM

Even if u use strip_tags function you can allow only <br> or <p> tags.
Cheers,
SamShel
-----------------------------------------------
--: FUTURE IS LINUX :--
-----------------------------------------------

#4 simonsays

simonsays
  • Members
  • PipPip
  • Member
  • 21 posts

Posted 20 September 2006 - 04:04 PM

thanks for the info :)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users