Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

Data Retrieval (un)formats my paragraphs

  • 01-07-2013 11:05AM
    #1
    Registered Users, Registered Users 2 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, Registered Users 2 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, Registered Users 2 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