SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2002
    Location
    Australia
    Posts
    89
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Formatting Text returned from database

    Hi

    I've got a database with a text field and when I retrieve the text from the database it comes out all unformatted and in just one paragraph. I want to make the new lines into <br>. I had a look at the n2lbr function however I was not able to work out how to use it. I would really appreciate if someone could help me with this function and how to implement it.

    Below is the code i was trying using the wordwrap function. I woudl appreciate if someone could edit the following code so the n2lbr function will work.

    PHP Code:
     <?php 
    $text 
    "".$row_Recordset1['lyrics'].""
    $newtext wordwrap$text10 ); 
    echo 
    $newtext\n <br>";
    ?>
    Thanks Alot,
    Ajay

  2. #2
    SitePoint Enthusiast CRYSTL's Avatar
    Join Date
    Sep 2003
    Location
    Kazakhstan
    Posts
    68
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Use it like this:
    PHP Code:
    echo nl2br($text); 


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •