Is it possible to save an HTML file to a BLOB
column within the database and then display it as part of the page in PHP?
Why do this: It's more for a learning experiment to compare if it gets better than a include
on the page.
Is it possible to save an HTML file to a BLOB
column within the database and then display it as part of the page in PHP?
Why do this: It's more for a learning experiment to compare if it gets better than a include
on the page.
The file itself is not possible, after all file is a concept of the operating system file system, but text that is HTML is entirely possible. It does not even have to be BLOB
. It can be this type of column, but it can be TEXT
or VARCHAR
and even CHAR
although probably quite inadequate. You do not need to have a file to generate the content, what will be delivered needs to be a text recognized as HTML, just this.
Of course, it is the function of your application to properly deliver to the HTTP server so that this HTML is sent to the client when it has a request. Your application can take this HTML from anywhere, can compose several parts, you can do whatever you want. If you can compose consistently it is a powerful tool to give flexibility in the result.
You should avoid abuse, have to take care of security, may not be the one that gives more performance, may not be the most suitable for what you need, but these are other issues.
I can already say that it does not get better than include
, just make use of a database if necessary.