Make Money Online BUILDING WEBSITES How to Create Content Management System in Php Part-01

How to Create Content Management System in Php Part-01

How to Create Content Management System in Php Part-01 post thumbnail image


In this article, we will be creating a content management system in php. This will be a two-part series, and in this part, we will be creating the basic structure of the system.

First, we need to create a database to store our content. We will be using mysql for this. You can create a new database by running the following command in the mysql console:

CREATE DATABASE content_management;

Next, we need to create a table to store our content. We will call this table “content”. The table will have the following fields:

id – This is the primary key and will be used to identify each row in the table.

title – This is the title of the content.

content – This is the content of the content.

published – This is whether the content is published or not.

We can create the table by running the following SQL command:

CREATE TABLE content ( id INT NOT NULL AUTO_INCREMENT, title VARCHAR(255) NOT NULL, content TEXT NOT NULL, published TINYINT NOT NULL, PRIMARY KEY (id) );

Now that we have our database and table set up, we can start writing the code for our content management system. We will start by creating a file called db.php and putting the following code in it:

connect_error) { die(“Connection failed: ” . $db->connect_error); } ?>

This code simply creates a new mysqli object and connects to the content_management database. It then checks to see if the connection was successful. If not, it prints out the error message.

Next, we will create a file called index.php and put the following code in it:

Content Management System

Content Management System

Tags: , , , , ,

Related Post