title: Warning: mysql_connect(): Access denied
body: <p>i have this php function to read my dbinfo out of a textfile on my pc:</p>
  <pre><code>function loaddb(){
      $fh = fopen('dta.txt','r');
          $line = fgets($fh);
          $_SESSION['dbname']=$line;
          
          $line = fgets($fh);
          $_SESSION['dbuser']=$line;
          
          $line = fgets($fh);
          $_SESSION['dbpass']=$line;
          
          $line = fgets($fh);
          $_SESSION['server']=$line;                                  
      fclose($fh);
  };
  </code></pre>
  <p>and this code works. but when it returns my code into my session var i see it has added extra line breaks in the actual variable, so the result when i connect is</p>
  <blockquote>
  <p>Warning: mysql_connect(): Access denied for user 'root</p>
  <p>'@'localhost' (using password: YES) in
  C:\Users\Jacques\Dropbox\Jacques\Web\Code.php on line 37 Could not
  connect: Access denied for user 'root</p>
  <p>'@'localhost' (using password: YES)</p>
  </blockquote>
  <p>how can i fix this. i have tried replacing all character return and spaces but it doesnt help</p>
  <p>this is the text in my textfile</p>
  <blockquote>
  <p>dbname</p>
  <p>root</p>
  <p>password</p>
  <p>localhost:3306</p>
  </blockquote>