Is it appropriate to store a web page in a Database?
I am using InnoDB engine of mysql, the email templates is a modified html files that is in mail format , so there should be a plain html file.
Notice that those templates are not accessible for everyone, they should refer to the userID, so for example, User A has template1 , 2 ,3.. but UserB may have template 2,3, 5, 6..
What datatype should i store this kind of file?
Or instead of using database, I should create a html file and use php to write in it and open a folder for each user?
Thank you for your help, I have less experience in handling this kind of data
Usually, and for most project, the database is the bottleneck. So, if you can avoid to use it, then don’t use it.
If the html is small (for example 10kb) then you can store in the database.
However, if it is big (and requires BLOB or a big varchar), then save it in a file folder using the unique id of the registry, having caution about the number of templates that could exists. However, a backup of the system requires to also backup those files (instead of a single backup of the database).
It sound like
Table User
Id_User
Name_User
…
Table Template
Id_Template
Name_Template
Content_Template (if it is not managed by a file)
….
Table UserxTemplate
Id_User
Id_Template
Obtain the all templates by an user
In resume
Store in the database
Pro:
Cons:
Store in a file
Pro:
Cons:
ps: WordPress and other portal and blog system (usually) store it inside the database, however LMS (Learning Management System) stores in a file.