Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Data Retrieval (un)formats my paragraphs

Options
  • 01-07-2013 11:05am
    #1
    Registered Users Posts: 44


    Hi,

    I have a database driven website. Im using SQL 2000 and ASP. Basically Im inserting blocks of paragraphs into the DB which is fine. When I look in the column in the DB, it holds its paragraph integrity but when I try to output it, it drops all the breaks etc and it comes out as one big blob of text.

    Is there anything I can do to retain the paragraph formatting.

    Thanks


Comments

  • Registered Users Posts: 2,021 ✭✭✭ChRoMe


    Hi,

    I have a database driven website. Im using SQL 2000 and ASP. Basically Im inserting blocks of paragraphs into the DB which is fine. When I look in the column in the DB, it holds its paragraph integrity but when I try to output it, it drops all the breaks etc and it comes out as one big blob of text.

    Is there anything I can do to retain the paragraph formatting.

    Thanks

    Include the html tags in the data thats inserted into the database, to retain the formatting.


  • Registered Users Posts: 44 MikeFantana


    damn you dreamweaver....:)

    How do i automatically put those tags. Is there a script or something I can run at the insert statement.


  • Moderators, Society & Culture Moderators Posts: 17,642 Mod ✭✭✭✭Graham


    Simplest method:

    when you return the text from the database, replace the newline with a[HTML]<br>[/HTML]
    <%=replace(myData, vbNewLine, "<br />")%>
    

    If you want to get a bit fancier, put a [HTML]<p>[/HTML] tag at the start of the data returned, a [HTML]</p>[/HTML] tag at the end and replace double vbNewLine with [HTML]</p><p>[/HTML]

    These methods have the advantage of not having to edit the existing data in your database.


Advertisement