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).
User A has template1 , 2 ,3.. but UserB may have template 2,3, 5, 6..
It sound like
Id_User Name_User ...
Id_Template Name_Template Content_Template (if it is not managed by a file) ....
Id_User Id_Template
Obtain the all templates by an user
select * from User a,Template b,UserxTemplate c
where c.id_user=a.id_user and c.id_template=b.id_template and a.id_user=xxx
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With