Jump to content


Photo

Detecting Line breaks.


  • Please log in to reply
4 replies to this topic

#1 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 19 July 2006 - 05:00 PM

Hi,
I wanted to insert some things into my database so the linebeaks do not get removed.
basically to send a private message and When I input:
Hi,
How are you?
ps. test


it looks like:
Hi, How are you? p.s test

Does anyone know what I can do?

#2 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 19 July 2006 - 05:01 PM

when you're echoing it from the database, use nl2br().

#3 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 19 July 2006 - 05:03 PM

Thanks, would that be:

<?PHP

echo 'nl2br(CODE HERE)';


#4 akitchin

akitchin
  • Staff Alumni
  • Advanced Member
  • 2,516 posts
  • LocationCalgary, AB, Canada

Posted 19 July 2006 - 05:04 PM

echo nl2br($variable_containing_the_post);


#5 xyn

xyn
  • Members
  • PipPipPip
  • Advanced Member
  • 779 posts
  • LocationNorthampton

Posted 19 July 2006 - 05:05 PM

oh yes :P thank you




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users