Purpose of Part 3
- Understand the basics of relational databases and be able to integrate them into web-based applications using PHP.
- Learn about PHP extensions and how to use other people’s code in your web app.
Prerequisites
- Part 1 of this series — the basics of PHP
- Part 2 of this series — PHP inter-page communications
- A need for working with data. Databases are never easy to work with. I’ve tried to create the simplest possible introduction, but still — if you don’t need a database — don’t bother!
- The basic concept behind databases — here is a great 5 minute YouTube tutorial (of which you only need the first 3 minutes).
- The basic concept of SQL — Structured Query Language — here is the world’s cutest 4 minute YouTube tutorial on SQL
- What is NOT a prerequisite — to get started with PHP installed, you do NOT need a web server like apache or a database server like MySQL installed. We’ve already seen how to use the PHP built-in web server. Here you’ll use its built in SQLite database routines.
Basic Concepts
- PDO — PHP Data Objects. SQL is a fairly standardized language that is used by numerous different implementations: MySQL, Postgress, Microsoft SQLServer, Oracle and others. Rather than having to rewrite your code for each one, PHP has PDO. While we’re NOT going to dive into the complexities of object-oriented coding, we can safely use PDO in our procedural coding without too much bother.
- PHPINFO. Your installation of PHP may or may not have PDO built in. How would you know? You need a simple one-line page phpinfo.php as follows:
<?php phpinfo(); ?>
header from a very long page from phpinfo
#php #sqlite #sql