title: PHP Fatal error: Call to a member function prepare() on null in
body: <p>I am getting this error when trying to access my site.</p>
  <p>Say the error is on line 11</p>
  <p>The path of DB_ACCOUNT is being made through htaccess</p>
  <p>Can someone help me?</p>
  <p>Edit .: I put the connection part but it didn't work either.</p>
  <pre><code>&lt;?php
  
  if (isset($_SESSION['id'])):
      $painel = 'inline';
      $pglogin = 'none';
  else:
      $painel = 'none';
      $pglogin = 'inline';
  endif;
  
  define('DB_HOST', '11.1.1.1.');
  define('DB_USER', 'test');
  define('DB_PASSWORD', 'xxxxxxx');
  
  define('DB_ACCOUNT', 'account');
  
  
  try {
      $conexao = new PDO('mysql:host='.DB_HOST, DB_USER, DB_PASSWORD, array(PDO::MYSQL_ATTR_INIT_COMMAND =&gt; 'SET NAMES utf8'));
      $conexao-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);    
  }
  catch(PDOException $e) {
      echo 'ERROR: ' . $e-&gt;getMessage();
  }
  
  $query = $conexao-&gt;prepare('SELECT * FROM '.DB_ACCOUNT.'.account WHERE login = :login');
  $query-&gt;bindValue(':login', $_SESSION['login']);
  $query-&gt;execute();
  $row = $query-&gt;fetch(PDO::FETCH_BOTH);
  $confemail = 'none';
  if ($query-&gt;rowCount() &gt; 0):
      if ($row['status'] == 'WEBBLK'):
          $pglock = 'none';
          $pgunlock = 'inline';
      else:
          $pglock = 'inline';
          $pgunlock = 'none';
      endif;
  
      if ($row['status'] == 'BLOCK' &amp;&amp; $row['active_conta'] &gt; 0):
          $confemail = 'inline';
      else:
          $confemail = 'none';
      endif;
  endif;
  
  ?&gt;
  </code></pre>