Dynamic Website News

A simple news article application using PHP and MySQL

How should we structure databases?

Article #5
13th March 2023

You can structure databases using an application called phpMyAdmin. You can access this application from the Databases block in cPanel (see previous article). Using phpMyAdmin, you can create new tables and structure those tables, adding columns for different data types.

creating a new table in phpMyAdmin

The structure of a database will vary a lot depending on the type of data you are using but, typically, you will want to break the dataset down into separate components. For example, if you have a database table for your favourite books, you may want columns for the book title, the author's name, the name of the publisher, the ISBN number, and a short synopsis or review. With that set of data, you could build a useful application, describing all your favourite books.

Hey this is Anumeha

Published: 12:03pm

How should we create databases?

Article #4
21st February 2023

Databases are usually created using the control panel provided by your web host. In most cases, on a LAMP stack server, that will be cPanel.

There are two ways to create a database in cPanel; you can either use the main MySQL Databases option or you can use the MySQL Database Wizard option. The choice is yours; the first option gives you greater control, but the second option is easier.

the cPanel Databases block

There are, essentially, three steps to creating a database. First, you give your database a name. Second, you give the database user a name and a strong password. Finally, you add the user to the database and specify what privileges that user has on that database (e.g. select, insert, update, drop). Most often, if we are creating a database for a content management system such as WordPress, we will give the user “All Privileges”.

Published: 1:08pm

PHP and MySQL work together perfectly

Article #3
18th February 2023

PHP and MySQL have a very close relationship. They have grown up and matured together. The PHP open source community have developed a range of functions that allow developers to easily access content in MySQL database and to use this content to build webpages.

The mysqli functions in PHP make it easier, faster and more secure to interface with any MySQL database. The “i” in mysqli stands for “improved“. The improved functions were introduced with PHP5 and should be used with MySQL 4.1.3 or higher.

Since we are now using PHP 8 and those earlier versions of PHP are now deprecated, it goes without saying that the mysqli functions should always be used when taking a procedural approach to database connections.

Published: 6:22pm

What applications use MySQL?

Article #2
15th February 2023

Almost all the web applications that we are familiar with use MySQL databases. Content management platforms like Wordpress, Drupal, Perch, and Craft, all use MySQL databases. Community forums like vBulletin, and Invision Community Suite, and wiki collaborative publishing platforms like MediaWiki all use MySQL to store their data.

the WordPress logo

However, PHP is required to select and extract data from MySQL databases and to construct dynamic web pages from it using PHP/HTML template pages.

For example, in a content management system, all the content of articles (text and links to images), the date, the name of the author etc. are stored in the database and are extracted and compiled “on the fly” using PHP each time the page is requested by a browser.

Published: 4:14pm

Introducing MySQL

Article #1
12th February 2023

MySQL Logo

This is the first article in this news feed. Over the next week or so, we'll be bringing you some important news about MySQL and how to work with databases using PHP. We'll be showing you how PHP can be used to connect to a database, to make a query and use the content in a database to create dynamic webpages that automatically update when that data changes. Stay tuned!