1. Home
  2. Computing & Technology
  3. PHP / MySQL
photo of Angela Bradley
Angela's PHP / MySQL Blog

By Angela Bradley, About.com Guide to PHP / MySQL

Store PHP in a MySQL Database

Tuesday April 11, 2006
You can store your entire website in a MySQL database. This includes both page content, and PHP code. You then retrieve the appropriate content and code to build each page of your site. You use can Print or Echo the content and HTML, and Eval the PHP code, as shown in our example.
Comments
July 20, 2008 at 2:12 pm
(1) Mike Knebel says:

Can you use classes in this? Example:
class clsMyClass {
var $myvar;
function clsMyClass() {
$this->myvar = “hello”;
}
}

then call from another page stored in MySql:

$oMyClass = new clsMyClass();
echo $oMyClass->myvar;

July 25, 2008 at 1:35 am
(2) Chris says:

I did notice that the insert statement for the template has an omission, this being the end head tag. This /head tag should be betwen the end title and body start tags.

However it should be rectified to ensure that user’s web pages are compliant with web standards.

I found your code very enlightening, which has given me a different perspective on how I should build pages.

Regards
Chris

Leave a Comment

Line and paragraph breaks are automatic. Some HTML allowed: <a href="" title="">, <b>, <i>, <strike>

Explore PHP / MySQL
About.com Special Features

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

Easy ways to connect two computers for networking purposes. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL

©2009 About.com, a part of The New York Times Company.

All rights reserved.