eBook PHP Tutorials: Programming with MySQL and PHP

This book was written from a set of courses I teach in a Further Education college. It contains of a number of code samples and examples which you can download from this site.

The book starts with an introduction to PHP and then goes on to MySQL and how to use SQL with the PHP language.

It provides an introduction to web programming, how to display data from a database and update data to the database. It explains issues that you encounter in real world situations and provides the basic code from which you can then use to further develop.

If would be helpful if you have some HTML knowledge but the examples do provide you with what you need know. It is also helpful to have had some experience in programming using one of the more popular languages such as Visual Basic although this is not necessary.

Many of the tutorials consists of a series of examples and tasks which are intended to illustrate each point and concentrate on simplified code so that you can see how to use it.

  • Introduction – Basic PHP concepts.
  • Variables – Variables, programming techniques and so on.
  • Forms and PHP – Posting data between forms.
  • Arrays – Loops and array structures.
  • Basic PHP structures – include files and how to use them.
  • Functions – Writing and using your own functions.
  • Posting Forms – How forms work.
  • Email Forms – An email form.
  • JavaScript – Posting forms with JavaScript.
  • SQL and MySQL – Querying database tables using SQL.
  • An Example table – Some example data.
  • Database Access – How to connect to a database.
  • Using PHP and MySQL – An example form.
  • Further PHP and MySQL – More PHP and MySQL.
  • Error handling and debugging – Simple methods to find errors.
  • Cookies and sessions – When and where to use them.
  • Modifying Records – Editing and updating databases with PHP and SQL.
  • Classes – An introduction to object orientated programming.
  • File Handling – Reading and writing to text files.
  • Regular Expressions and Validation – Some validation methods.
  • PDO Class – An example of a class for PDO.
  • PHP Cart – A full working shopping cart example.
  • PHP security – Some methods to overcome this issue.
  • JQuery, Ajax and Bootstrap.
  • htaccess and php.ini – How to use them.
  • WordPress – An introduction to creating a WordPress Plugin.
  • Appendix – XAMPP Server and MySQL Management.

Download Sample Chapters

A sample of the book with the contents page is available on the amazon web site at https://www.amazon.com/dp/0992869765(US) or https://www.amazon.co.uk/dp/0992869765(UK)

Updated to edition 6 with new examples, expanded code explanations and updated material.


The book is available in various formats: paperback, Kindle eBook or PDF.

There are a number of ways that you can purchase the Book:
Click on this button will take you to the amazon web site to purchase in Kindle version or paperback.

US Kindle Store

UK Kindle Store

Click on this button will allow you to purchase the PDF of the book using PayPal or any credit card that PayPal will accept.

Code downloads

The PHP code for the latest version of the book can be obtained in one zip file from the link below:

Download Source Code

The book references the code by chapter and name so you should be able to easily find any particular script that you are looking for.