Jump to content


Photo

Outputting "text" from mysql with whitespace


  • Please log in to reply
3 replies to this topic

#1 onemind

onemind
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 24 July 2006 - 07:15 AM

Hi,

I have a text field in a mysql table and i output it to my page with php.

The only thing is, the text outputs fine but it gets rid of all whitespace so there are no paragraphs ect and it looks like one big block of text.

Is there any way to preserve the whitespace?

Thanks for any info. :)

#2 localhost

localhost
  • Members
  • PipPipPip
  • Advanced Member
  • 152 posts

Posted 24 July 2006 - 08:10 AM

Use a WYSIWIG editor.

http://www.google.co... editor&spell=1

#3 onemind

onemind
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 24 July 2006 - 08:39 AM

What?

How will that possibly help?

Maybe i want clear enough, i have a field in a mysql table of the "text" datatype.

When i select a text object from the database and output it with php, the whitespace is gone.

I remember there was a solution to this a while back. A certain php function that adds whitespace back to the original text.



#4 onemind

onemind
  • Members
  • PipPip
  • Member
  • 28 posts

Posted 24 July 2006 - 08:47 AM

Its all good, i figured it out:

echo nl2br($text);

:)




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users