Results 1 to 8 of 8

Thread: retrieving MySQL string's

  1. #1

    Thread Starter
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609

    retrieving MySQL string's

    when a string is saved on the server, how can i retrieve it with the line-breaks still there ? (insert '<br>' where appropriate)

  2. #2
    New Member
    Join Date
    Jun 2002
    Location
    Nottingham, United Kingdom
    Posts
    6
    Explain more....
    ================
    ClickMamba.com
    [email protected]

  3. #3

    Thread Starter
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    if i had to save a string from an html input field, it should just save it as a straight line od\f text. but i want it to be multiple lines like it was when entered in the field.

  4. #4
    New Member
    Join Date
    Jun 2002
    Location
    Nottingham, United Kingdom
    Posts
    6
    use the nl2br() function. I believe that should do the trick. Read up on it at http://www.php.net/nl2br/. Never used it though so i cant advise.
    ================
    ClickMamba.com
    [email protected]

  5. #5

    Thread Starter
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    thanx pro

  6. #6
    scoutt
    Guest
    or you can use this

    $textboxreplace("(\r\n|\n|\r)", "<br>", $textbox);

  7. #7

    Thread Starter
    Fanatic Member ubunreal69's Avatar
    Join Date
    Apr 2001
    Location
    Morayfield, Australia
    Posts
    609
    i was initially thinking along those lines scoutt

    but didnt you mean:

    $textbox = replace("(\r\n|\n|\r)", "<br>", $textbox);

  8. #8
    scoutt
    Guest
    well close. I did mess up though so it should be like this

    $textbox = ereg_replace("(\r\n|\n|\r)", "<br>", $textbox);

Posting Permissions

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



Click Here to Expand Forum to Full Width