title: define for mysql connect
body: <p>My situation:
  Folder structure is  /resources/website/inc/ (/resources/ is where configs are stored, /website/ holds index.php and /inc/</p>
  
  <p>I have defined my constants for db connection in  config.php / in resources folder.</p>
  
  <pre><code>   define ( 'DB_HOST', 'localhost' );
     define ( 'DB_USER', 'my_username' );
     define ( 'DB_PASSWORD', 'my_password' );
     define ( 'DB_NAME', 'my_database' );
  </code></pre>
  
  <p>In index.php the database is accessed and displays data.</p>
  
  <p>I've come to the conclusion that it am trying to use the defined constants in config.php with a connect statement in index.php, but the constants are not passing.</p>
  
  <p>This is my connect statement:</p>
  
  <pre><code>$connect = mysql_connect(DB_HOST, DB_USER, DB_PASSWORD) or 
                           die("MySQL Error: " . mysql_error());
  $db = mysql_select_db(DB_NAME) or die("MySQL Error: " . mysql_error());
  </code></pre>
  
  <p>When i add both pieces into the config.php it works fully, but i wanted to have connect and close of connection in various areas, i do not want to have to define the variables again</p>