#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    Question From SQL database (text) to html code


    Hi This is Ralph I am new in php language. I can do database in php I have text datatype and I have an article inside of that database. I just want to print it on HTML format without adding <br> or other html tags.

    Thank you very much I appreciate your help !!


    Again Thank you so much!!!!
  2. #2
  3. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Hi,

    what did you write down so far? What's your question?
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    Question


    Originally Posted by Jacques1
    Hi,

    what did you write down so far? What's your question?
    I would like to make an output to html using data from my database without adding any br tags I mean it will generate automatically?

    is that possible?
  6. #4
  7. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    Still not quite sure what you're trying to do.

    Do you want to convert the newlines within the text to HTML breaks? If so, use nl2br. But make sure to escape the text with htmlspecialchars so that people don't inject malicious JavaScript into your page.
  8. #5
  9. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0
    Hi thank you very much for you help! bro!
    the answer is

    <pre> </pre> tag thank you so much!
  10. #6
  11. --
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2012
    Posts
    3,957
    Rep Power
    1046
    And the question should have been: "How do I preserve the formatting of text in HTML?"
  12. #7
  13. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jan 2013
    Posts
    4
    Rep Power
    0

    Wink


    Originally Posted by Jacques1
    And the question should have been: "How do I preserve the formatting of text in HTML?"
    I am very sorry for the confusion I made because I do not know the terminologies yet. thank you very much you are such a great help!

IMN logo majestic logo threadwatch logo seochat tools logo