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
    Jun 2010
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Problem while displaying the content...

    Hi Everyone ,

    I have column of data type ntext in my table in database which contains the html content like
    [code]
    <p style="text-align: center" >this is sample text populated for testing </p>
    <b style="text-align: center" >this is sample text populated for testing </b>
    etc......
    [code]
    I want to display the text from database on to the browser . when i am simply getting the value from DB using php and displaying as
    echo $row['description'] since the column is very huge the data is occupying
    large space on the browser . so, i tried to display that text using the textarea tag in html but the textarea is displaying the content from database as it is with the html tags and not applying any html tags to output like
    [code]
    <p style="text-align: center" >this is sample text populated for testing </p>
    <b style="text-align: center" >this is sample text populated for testing </b>
    etc......
    [code]
    So i need to display the text from database on to the browser by using any tag which can reduce space occupied by text ??????????

    Please help me .... Thank in advance ....

  • #2
    Senior Coder
    Join Date
    Jun 2008
    Location
    New Jersey
    Posts
    2,530
    Thanks
    45
    Thanked 259 Times in 256 Posts
    When you store it to the database, I'm assuming you're sanatizing and converting non-alphanumerics into their html code? Cuz that seems to be whats going on.

  • #3
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,978
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    I'd keep it the way it is if its to be used as HTML. Sounds like this is going into an editor.
    Run it through htmlspecialchars() / htmlentities() first before printing it to a text area.
    And I'm not sure I follow you on the 'space' part. If its in a text area, you can specify the columns and rows. If its to be displayed as HTML code, you can wrap the entire block in a div with an overflow and height on it to give you scroll bars.
    If you mean the actual data size for the space, the only way to get around that is to delete text.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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