<?php
// p.248 Example 11-1 "The login.php file"
// p.250 Example 11-2 "Connecting to a MySQL server using PDO"
// NOTE: in your files, instead of "localhost" use YOUR machine name
// as I've done below with 'farheen.sewanee.edu'
try {
$pdo = new PDO("mysql:host=farheen.sewanee.edu;dbname=aliens", "guest", "pssst");
} catch (PDOException $e) {
echo "Sorry, that didn't work out for you...";
}
?>
// playing with date functions & formats...
// 'h' 12-hour, 'i' for minutes, 's' seconds and A for am/pm
$date .= date('h:i:s A');
$query="insert into color(name,red,green,blue) values ('PINK! @$date',240,3,252)";
In this class, I will never ask you to grant to any web user privileges sufficient to create or drop tables and/or datbases so you can ignore the php involved in Examples 11-7, 11-8, & 11-9.