Using external variables in classes
<p>I have a directory structure:</p>

<pre><code>app
cofig
 config.php
classes
 db.class.php
index.php 
</code></pre>

<p>config.php:</p>

<pre><code>&lt;?php

define('DB_HOST', 'localhost'); 
define('DB_USER', 'root'); 
define('DB_PASS', ''); 
define('DB_NAME', 'db_name');  
</code></pre>

<p>db.class.php:</p>

<pre><code>&lt;?php 
include "config/config.php";

class DB {

private $conn;
private $results;

public function __construct() {

$this-&gt;conn = mysql_connect(DB_HOST, DB_USER, DB_PASS);//**This doesn't work**
mysql_select_db(DB_NAME, $this-&gt;conn);
}

}
?&gt;
</code></pre>

<p>when I try to create an instance of the $db class in index.php, I get errors (cannot obtain DEFINED variables in class)</p>
