PHP for Beginners - Part 8 - What the heck is PDO?

Okay, lets continue where we left off with MySQL prior to learning classes.

First, make sure your MySQL still works. Ensure you have a usable database for use by the PDO builtin class for PHP.

$ mysql
$ -> create database mytodo; # Create the database
$ -> show databases # Ensure it appears
$ -> exit

Alright, now lets dive in.

// index.php


try {
  $pdo = new PDO('mysql:host=;dbname=mytodos', 'root', 'Medic12!');
} catch(PDOException $e) {
  die('could not connect.');

require 'index.view.php';