Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Oct 2007
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Keep Formatting when adding to database

    Hi guys

    Just a question about the format of data when input into a database.

    I have a bit of script that allows people to place comments on my site, and i was wondering how do i make it keep the format that they enter it it, such as new lines, etc?

    Because all the text comes out in one long line!

  • #2
    UE Antagonizer Fumigator's Avatar
    Join Date
    Dec 2005
    Location
    Utah, USA, Northwestern hemisphere, Earth, Solar System, Milky Way Galaxy, Alpha Quadrant
    Posts
    7,691
    Thanks
    42
    Thanked 637 Times in 625 Posts
    Use nl2br(). But only use it when selecting/displaying data from the database; it's better to store the data without the br tags.

  • #3
    New Coder
    Join Date
    Oct 2007
    Posts
    12
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Cheers man you are a star!!


  •  

    Posting Permissions

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