Adding Paragraphs in Dynamic Text HELP!

Discussion in 'PHP' started by Fothy, Aug 1, 2006.

  1. #1
    I am creating a lyrics website, and am accessing lyrics from my MySQL database, all working, except all the lyrics are in a block and not paragraphed on the page :confused:

    when i click "nowrap" (in dreamweaver 8) it makes it all into 1 line, i cant make it format to paragraphs.

    by the way, the entry in the database does have paragraphs in the data.

    please help :)

    James.
     
    Fothy, Aug 1, 2006 IP
  2. T0PS3O

    T0PS3O Feel Good PLC

    Messages:
    13,219
    Likes Received:
    777
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Use PHP's nl2br() function.
     
    T0PS3O, Aug 1, 2006 IP
  3. Fl1p

    Fl1p Active Member

    Messages:
    511
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #3
    Use nl2br() function as T0PS3O suggested that way your line breaks will be preserved. Use this before entering data into your database.
     
    Fl1p, Aug 1, 2006 IP
  4. e_hippie

    e_hippie Guest

    Messages:
    32
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Would it also be wise to check for the existence of "<br>" via a case insensitive search of the text before applying nl2br()?
     
    e_hippie, Aug 1, 2006 IP
  5. loveindia

    loveindia Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Just add "/n" linux ; or "/r/n"; in windows
     
    loveindia, Aug 2, 2006 IP
  6. Fothy

    Fothy Guest

    Messages:
    4
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    thanks guys!

    so where would i add this nl2br() function?? sorry i am a little confused! :confused:

    thanks guys - helps a lot! :D
     
    Fothy, Aug 2, 2006 IP
  7. web-spy

    web-spy Active Member

    Messages:
    127
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    93
    #7
    man, if you no nothing then dont start building such a site. or just rtfm
     
    web-spy, Aug 4, 2006 IP