The tutorial I am following online has me create two different PHP files. This is the Database.php file:
<?php
class dbConnection
{
    protected $db_connection;
    public $db_name = "todo";
    public $db_user = "root";
    public $db_password = "";
    public $db_host = "localhost";
    function connect()
    {
        try
        {
            $this -> db_connection = new PDO("mysql:host=$this->db_host;dbname=$this->db_name", $this -> db_user, $this -> db_password);
            return $this -> db_connection;
        }
        catch(PDOException $e)
        {
            return $e -> getMessage();
        }
    }
}
?>
This is the ManageUsers.php file:
<?php
include_once ('Database.php');
class ManageUsers
{
    public $link;
    function __construct()
    {
        $dbConnection = new dbConnection();
        $this -> link = $dbConnection -> connect();
        return $this -> link;
    }
    function registerUsers($username, $password, $ip_address, $date, $time)
    {
        $query = $this->link->prepare('INSERT INTO users(username, password, ip_address, reg_date, reg_time) VALUES (?,?,?,?,?)');
        $values = array(
            $username,
            $password,
            $ip_address,
            $date,
            $time
        );
        $query -> execute($values);
        $rowCount = $query -> rowCount();
        return $rowCount;
    }
}
$users = new ManageUsers();
echo $users -> registerUsers("Bob", "Bob", "127.0.0.1", "07/08/2013", "9:34 A.M.");
?>
It keeps failing on the prepare(), and nothing in the tutorial tells me why. Any help would be greatly appreciated.
 
     
    