SitePoint Sponsor |
|
User Tag List
Results 1 to 1 of 1
-
Aug 19, 2008, 17:06 #1
- Join Date
- Aug 2003
- Location
- Southern California, United States
- Posts
- 1,616
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
Script tries to download instead of display... working with PDO
Hi before it gave an error that I didn't have the PostGreSQL driver for PDO so I installed it through the command line and changed my pdo.ini file to include it. After I went back to this script and it would not display it would just try to download from firefox. Can someone please tell me what is wrong? Here is the code:
PHP Code:<?php
// Include The Configuration
require_once('configuration.php');
// Database Class
class Database {
// Class Variables
public $status;
private $dbh;
// Connect To The Database
public function __construct($dsn) {
try {
$dbh = new PDO($dsn);
$this->status = 'Connected!';
} catch (PDOException $e) {
$this->status = 'Connection failed: ' . $e->getMessage();
}
}
// Display The Status
public function __toString() {
return $this->status;
}
}
$database = new Database($dsn);
echo $database;
?>Have a good day.
Bookmarks