How to store articles in mysql database

I need to store articles submitted by users of my site.

1. Articles will be 100 to 200 lines long.

2. Articles will have html tags. For instance:

"<br>" 

Tell me which "TYPE" should be selected when creating a column in the MYSQL database and tell me also "LENGTH".

I tried VARCHAR but it does not work.

+4
source share
4 answers

Use column types TEXT or MEDIUMTEXT or LONGTEXT

TEXT column can store 65,535 characters MEDIUMTEXT can store 16,777,215 characters LONGTEXT can store 4,294,967,295 characters.

Note that if characters are multi-byte characters (e.g. UTF-8), then these numbers are less.

+9
source

use the TEXT type when saving long text.

+5
source

you can use TEXT or MEDIUMTEXT or LONGTEXT

see this http://dev.mysql.com/doc/refman/5.0/en/blob.html

+1
source

Instead of users entering HTML text, rather, let them use markup syntax. Something similar to what SO provides.

You can save them in a TEXT type field, and then use client-side scripts to parse them as HTML.

+1
source

All Articles