PDO and defined constants .. php error
<p>I have set constants for database in connect.php.    </p>

<p>connect.php</p>

<pre><code>define('DB_HOST','localhost');
define('DB_NAME','dbname');
define('DB_USER','dbuser');
define('DB_PASSWORD','dbpass');
</code></pre>

<p>Here is the Database Class</p>

<pre><code>require("connect.php");
    class Database {

    private $connect;

    function opendb() {
    $this-&gt;connect = new PDO(DB_NAME, DB_USER, DB_PASSWORD);

    }


    function closedb() {
    $this-&gt;connect =  null; //close connection

    }

    }
</code></pre>

<p>I get this error when i load the page that accesses the database class.</p>

<pre><code>Fatal error: Uncaught exception 'PDOException' with message 'invalid data source name'
</code></pre>

<p>what did i do wrong?</p>
