storing line breaks in sql

Discussion in 'OT Technology' started by Dustro, Jan 9, 2006.

  1. Dustro

    Dustro New Member

    Joined:
    Nov 1, 2003
    Messages:
    2,123
    Likes Received:
    0
    Location:
    NC
    im looking for a way to have a textarea that is pushed into a field that i can pull back out for display and retain line breaks made in the textarea. I have googled and came up empty and have only been able to obtain this by manually putting html breaks in at the end of each line which I dont want the people who will be using this to have to do.... sooo any help would be appriciated!
     
  2. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
    replace \n with <br /> when you pull it.
     
  3. Dustro

    Dustro New Member

    Joined:
    Nov 1, 2003
    Messages:
    2,123
    Likes Received:
    0
    Location:
    NC
    ok so the text area does declare the new line with a \n? what would I have to do to achive this?

    im working with php and mysql
     
  4. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
  5. Dustro

    Dustro New Member

    Joined:
    Nov 1, 2003
    Messages:
    2,123
    Likes Received:
    0
    Location:
    NC
    thanks looks like what im needing, still not having any luck though.

    I put
    Code:
    str_replace('\n','<br>',$varible);
    in my display query after assigning the row values to the varible and before displaying and its still not showing up :wtc:


    edit i got it after some tinkering and searching with this
    Code:
       $varible = addcslashes($
    Code:
    [FONT=monospace]varible[/FONT][FONT=monospace], "\n,\\");
       [/FONT][FONT=monospace]
       $[/FONT][FONT=monospace]varible[/FONT][FONT=monospace] = str_replace('\n','<br>',$[/FONT][FONT=monospace]varible[/FONT][FONT=monospace]);[/FONT]



     
    Last edited: Jan 9, 2006
  6. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    OMG php is ugly. Perl ftw.

    Sorry, I'm a bigot.
     
  7. CyberBullets

    CyberBullets I reach to the sky, and call out your name. If I c

    Joined:
    Nov 13, 2001
    Messages:
    11,865
    Likes Received:
    0
    Location:
    BC, Canada/Stockholm, Sweden
    :werd: string manipulation in perl is where it is at.
     
  8. Dustro

    Dustro New Member

    Joined:
    Nov 1, 2003
    Messages:
    2,123
    Likes Received:
    0
    Location:
    NC
    i took a perl class but it sucked and i didnt learn much :(
     
  9. Peyomp

    Peyomp New Member

    Joined:
    Jan 11, 2002
    Messages:
    14,017
    Likes Received:
    0
    You haven't learned much PHP either.
     
  10. Dustro

    Dustro New Member

    Joined:
    Nov 1, 2003
    Messages:
    2,123
    Likes Received:
    0
    Location:
    NC
    thanks for pointing that out :hsd:

    all i know is what i have picked up from web tutorials and google :wtc:


    anyways thanks CyberBullets for pointing me in the right direction
     

Share This Page