SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Location
    Turnersvill, NJ
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I just started to learn PHP and had a (hopefully!) quick question.

    I was going to create a lyrics page that would list a bunch of song lyrics. When I type the lyrics in my database, it comes out one big string (even though I put carriage returns in) Is it possible to have the lyric field look like this:

    mary had a
    little lamb
    little lamb
    little lamb

    instead of:

    mary had a little lamb little lamb little lamb

    when I display it on the web page?

    (lyrics are just an example! )

    thanks!
    Keith

  2. #2
    SitePoint Wizard silver trophy Karl's Avatar
    Join Date
    Jul 1999
    Location
    Derbyshire, UK
    Posts
    4,411
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You can use the function nl2br() to convert the line feeds to <br>s e.g.

    Code:
      $lyrics = nl2br( $lyrics );
    Karl Austin :: Profile :: KDA Web Services Ltd.
    Business Web Hosting :: Managed Dedicated Hosting
    Call 0800 542 9764 today and ask how we can help your business grow.

  3. #3
    SitePoint Enthusiast
    Join Date
    Jun 2000
    Location
    Turnersvill, NJ
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks!


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
  •