title: PHP Include DB Conn - Password not accessible
body: <p>I have a strange include file problem. I'm hoping its a simple fix due to being a 2-day-old, PHP noob.</p>
  
  <p>I'm simply trying to include DB credentials in to my parent script, like this:</p>
  
  <p><strong>db-conn.php</strong></p>
  
  <pre><code>&lt;?php
  $dbUsername = "xxx";
  $dbPassword = "xxx";
  $dbHostname = "localhost";
  ?&gt;
  </code></pre>
  
  <p><strong>parent.php</strong></p>
  
  <pre><code>&lt;?php
  include("c:/inetpub/vhosts/mydomain.net/php-private/db-conn.php");
  
  //echo $dbPassword;
  //echo $dbUsername;
  
  $dbHandle = mysql_connect($dbHostname, $dbUsername, $dbPassword) or die("Unable to load page content due to a connection fault.");
  unset ($dbHostname, $dbUsername, $dbPassword);
  
  echo "Connected to MySQL&lt;br&gt;&lt;br&gt;";
  ?&gt;
  </code></pre>
  
  <p>But I'm getting this error:</p>
  
  <p><strong>Access denied for user 'xxx'@'localhost' (using password: NO)</strong></p>
  
  <p>What is strange about this (for me) is that I can echo the username and hostname successfully but I cannot echo the password, it's empty. Yet if I go to my include file, copy the password from 'dbPassword' and paste it inline on my parent page, it works. This proves my password is correct, the username and hostname ARE included, I just can't access my password variable!</p>
  
  <p>Can somebody pleeeease put me straight here. I've already pulled my hair out tonight with open_basedir and permissions for this include file!! <em>_</em></p>
  
  <p>*<em>UPDATE - *</em></p>
  
  <p>Problem solved, please see my answer below.</p>