Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8667427
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:57:39+00:00 2026-06-12T17:57:39+00:00

I was planning to store user comments in a database and was wondering how

  • 0

I was planning to store user comments in a database and was wondering how to store the raw text that users will provide since it could contain anything. What is a common/good practice in regards to this? Do I need to parse the text or is there a special storage type that I should be using? It seemed like a lot of overhead to be parsing user comments that could potentially be quite long and I don’t want to be tampering with the intended meaning of a message etc. It seemed strange to be treating a comment/forum post in the same manor as say a username/password and sanitize.

I am using sqlite3 and some scripts to query the db and was planning on implementing something along the lines of:

page_id    post_number    username    content
-------    -----------    --------    -------
1          1              user_23     blah there's blah "quote" blah;':".,-=.

But, of course, if I was to just expand my content param into my INSERT query, there is going to be all kinds of problems with ' " etc.

How should I be handling the content in this table; should it even be in the table like this? What data type should I be using etc.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T17:57:40+00:00Added an answer on June 12, 2026 at 5:57 pm

    The data type to use depends on the overall size of the input.
    Text would be my first choice.

    for more on sqlite3 datatypes see
    http://www.sqlite.org/datatype3.html

    I would recommend you
    Sanitize the input, only allow necessary markup.
    Encode the content so it’s safe to insert into the database.

    If security is a serious concern this processing should be done server side. It won’t hurt to put some of this processing load to javascript this will reduce the work done at the server. Tho it would still catch user(s) trying to circumvent the feature.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are planning to store millions of documents in MongoDB and full text search
I'm planning to store player stats in a database for a game, and need
I'm planning to use Serialization to save the Bean modified by user--to store the
How can I store a video (either in database or file system) so that
I'm planning an Android application that allows users to fill out a form and
I'm planning the structure of a MySql database and could use some advice from
I'm planning on creating an app (Rails) that will have a very large collection
I am designing a database that needs to store transaction time and valid time,
I'm planning to build an application that must allow the user to set up
I'm planning to save keyboard shortcut in database. When User pressed the shortcut key,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.