Results 1 to 2 of 2
  1. #1
    Join Date
    Apr 2010
    Posts
    24

    Unanswered: Storing content with html tags in db

    I'm hoping you guys can shed some light on this.

    I'm writing a quiz program. I'm pulling questions and answers from a db. Some answers require a checkbox, some a text input, etc. So instead of writing a decision block to determine what type of input tags are needed, I was wondering about storing the content (answers in this case) with their needed html tags in the db instead, so when I iterated through the answers query, each answer would come with its needed input tags.

    I'm wondering if I can get your opinions, any known standards/problems, etc. for storing content with html tags in the database.

    Thanks in advance for reading.
    DevilsAdvocate
    ------------------------
    The elephant in the room
    ------------------------
    Ordo ab chao

  2. #2
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    storing content with html tags in the database is fairly common

    for example, many CMS (content management systems) do this

    however, for your application, it isn't necessary

    different answer types will be stored differently based on their inherent data contents, and not based on the html which displays them
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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