A PHP MySQL Tutorial for Bloggers

ByDr.-Ing. Erik Neitzel
A PHP MySQL Tutorial for Bloggers

In our SEO blog we often talked about so called “onpage” criteria – things you need to take care of on your website. Within that scope, technical requirements are often addressed by a Content Management System like WordPress. However, while talking about web auditing, we also noted that there are times when you need to take things into your own hands. Code responsibility is always yours, no matter which technology you choose to use.

In short, you need to be able to fix things when they went out of order. This tutorial will give you a definite how to in order for you to understand, construct, develop and/or fix your website by teaching you how to build a standalone database supported web application using PHP and MySQL. This is meant as a complete tutorial and will take you by the hand step by step through all you need for a minimal PHP and MySQL based web application.

We will go into infrastructure basics as well as database concept foundations and step-by-step HTML notation and PHP programming exercises. However, please read this first page carefully before proceeding any further.

A Complete PHP MySQL tutorial

This is your starting point. Feel free to get back to this post every time you like.

Let’s get started right away. In order for you to grasp everything you need to know about PHP and database development, we recommend going through this tutorial step by step. The following lessons are designed to be worked through in chronological order.

  1. Lesson 1: Client and Server Infrastructure: File, Web, Database tools vs. WordPress
  2. Lesson 2: Relational Database Management System Basics
  3. Lesson 3: Database Modelling and Structurization
  4. Lesson 4: VI Editor in Unix
  5. Lesson 5: HTML Coding Basics
  6. Lesson 6: HTML form elements
  7. Lesson 7: Learning PHP: programming basics for output, calculation and variables
  8. Lesson 8: PHP for loops and conditions
  9. Lesson 9: How to use PHP functions
  10. Lesson 10: PHP GET and POST parameters
  11. Lesson 11: How to build a website — PHP navigational skeleton step by step
  12. Lesson 12: How to connect to MySQL using PHP
  13. Lesson 13: PHP Login Script Tutorial
  14. Lesson 14: Dynamic PHP based MySQL data management with HTML output

If you have doubts wether you need to understand all that, feel free to read ahead.

The idea behind modern web development

But worry aber PHP or MySQL at all? Well, ever since the concept “web 2.0” came up, the user was meant to participate in the content delivery of a modern web page. For example, a user can take part in content creation by:

  • creating a blog post or a page in WordPress
  • posting a comment underneith a blog post
  • posting a guest book entry on someones personal website
  • posting a statement to a community forum
  • posting texts to a Wiki
  • uploading media (images or videos) to a social network
  • sharing documents with team mates in a web collaboration system
  • changing attribute values of data sets in a global music library
  • adding or deleting items within a geo caching record system

All of the above require data handling capabilities of the web site in question. A web site is no longer a static item delivering simple hard coded structured data via HTML. Web 2.0 web pages require dynamic data display. To achieve that, communication between the web server and a database server which delivers the ever changing data is required.

PHP MySQL tutorial

Between the ideas of delivering structured display data via HTML and managing data coming from a database system such as MySQL, PHP is used to introduce various algorithms such as loops and data sorting functions. Using databases like MySQL to hold data and HTML as a way to formulate visual markup, PHP is the binding element for both sides to understand each other.

A HTML form may present a way to input guest book data such as your name and your entry text. PHP then reads that data and passes it to the database. The database system then inserts the data received from PHP to the pre-defined database tables. Another web page can then use PHP to read the content of a specific database table, or even different tables combined, and present that data, e.g. the guest book content, including the newly created entry. PHP then not only handles the data readout, but it also generates the HTML output you desire.

Now that must all sound pretty horrible. Actually it’s not. All the concepts above will be explained in more detail using this tutorial.

PHP and database development for Bloggers

This guide is scructured in a way that it can serve as a reference sheet regarding certain source code or concept ideas even when you already know how to code. Still, this guide does not require you to have any skills to start using it. Every blogger will have the benefit in understanding all that is tought here. In fact the material in front of you was used for basic first semester University programming and database classes — with great success and feedback.

Understanding how modern web technologies like PHP and MySQL work together is essential to grasp the basics on how a Content Management System like WordPress functions – and how to fix themes or plugins when things are broken.

Whenever you need an overview, feel free to get back to this post. Have fun! 🙂

Dr.-Ing. Erik Neitzel