Skip to content
Advertisement

Should a database be used for storing rich text?

I’m working on a web app for a private team that should let them post text documents, like a text editor, via PHP and then hypothetically it will be displayed on the site so it can be opened and viewed in the browser by other users. Basically like a post system.

I figured it should be stored using a database like mySQL/mariaDB but as I’m new to databases still I’m not fully sure whether a database can store that much text and keep it formatted.

So how should I go about storing this kind of text so it can then be fetched and posted?

Advertisement

Answer

Like user3783243 said TEXT data type can work pretty well as it can hold 65,535 characters. However, if you need something larger than that, you can use LONGTEXT which is capable of holding 4,294,967,295 or 4GB of Characters. This means users could make very long text files and it should still be capable of holding the entire text file.

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement