Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Storing and fetching multiple paragraphs using PHP

Tags:

file

php

mysql

So I am working on a small project and using PHP/MySQL so far.
I wanted to know how do I go on storing very long text (let's say a user inputs a lot of paragraphs at once). Is using SQL for saving the text a good idea? Or should I save the huge amount of text using some other method instead? Thanks!

EDIT: Forgot to mention I am currently using LONGTEXT to store the text. I just wanted to know if it's a good approach to store such amount of text in a db.

like image 253
PS7 Avatar asked Mar 04 '26 22:03

PS7


1 Answers

It's fine to store long text in Mysql database, just make sure you use appropriate column type in mysql database:

TEXT - Holds a string with a maximum length of 65,535 characters

MEDIUMTEXT - Holds a string with a maximum length of 16,777,215 characters

LONGTEXT - Holds a string with a maximum length of 4,294,967,295 characters

like image 199
evgpisarchik Avatar answered Mar 07 '26 20:03

evgpisarchik