title: Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1044] When I uploaded it online
body: <p>When I'm using XAMPP localhost my system is working but when I upload it in cpanel other page not working. other page is working like login but in view and edit page it gets error.</p>
  
  <p>I got this error:</p>
  
  <pre><code>Fatal error: Uncaught exception 'PDOException' with message 'SQLSTATE[HY000] [1044] Access denied for 
  </code></pre>
  
  <p>other page:</p>
  
  <pre><code>Connection failed: SQLSTATE[HY000] [1044] Access denied for user 
  </code></pre>
  
  <p>my connection: </p>
  
  <pre><code>&lt;?php
  $db_host        = 'localhost';
  $db_user        = 'xxx';
  $db_pass        = 'xxx';
  $db_database    = 'xxx'; 
  
  $db = new PDO('mysql:host='.$db_host.';dbname='.$db_database, $db_user, $db_pass);
  $db-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
  
  ?&gt;
  </code></pre>
  
  <p>if I changed the connection approach</p>
  
  <pre><code>&lt;?php
  mysql_connect("localhost", "xx", "xx") or die(mysql_error());
  mysql_select_db("xx") or die(mysql_error());
  ?&gt;
  </code></pre>
  
  <p>I got this error:</p>
  
  <pre><code>Fatal error: Call to a member function prepare() on a non-object in 
  </code></pre>