title: Fatal error: Uncaught PDOException ("SQLSTATE[42S02]")
body: <p>I am having below error when trying to delete an item.</p>
  <blockquote>
  <p>Fatal error: Uncaught PDOException: SQLSTATE[42S02]: Base table or
  view not found: 1146 Table 'databaseName.tableName' doesn't exist in
  /storage/h1/735/500735/public_html/delete.php:21 Stack trace: #0
  /storage/h1/735/500735/public_html/delete.php(21):
  PDOStatement-&gt;execute() #1 {main} thrown in
  /storage/h1/735/500735/public_html/delete.php on line 21</p>
  </blockquote>
  <p>Note : <code>tableName</code> here is <code>tblcart</code></p>
  <h3>File <em>delete.php</em></h3>
  <pre><code>&lt;?php
      session_start();
      require(&quot;dbconfig.php&quot;);
      if (isset($_GET['delete_id'])) {
          $stmt_select = $DB_con-&gt;prepare('SELECT * FROM tblcart WHERE productID =:id');
          $stmt_select-&gt;execute(array(':id'=&gt;$_GET['delete_id']));
          $result=$stmt_select-&gt;fetch(PDO::FETCH_ASSOC);
  
          $stmt_delete = $DB_con-&gt;prepare('DELETE FROM tblCart WHERE productID =:id AND userID =:userID');
          $stmt_delete-&gt;bindParam(':id', $_GET['delete_id']);
          $stmt_delete-&gt;bindParam(':userID', $_SESSION['userid']);
          $stmt_delete-&gt;execute();
  
          header(&quot;Location: cart.php&quot;);
      }
  ?&gt;
  </code></pre>
  <p>Refer to the error note. The error occurred on line <code>$stmt_delete-&gt;execute();</code>. If I run the code through my local PC localhost, it is functioning well, but when running on a web hosting server I am getting this error.</p>
  <h3>File <em>dbconfig.php</em></h3>
  <pre><code>&lt;?php
      $DB_HOST = 'localhost';
      $DB_USER = 'root';
      $DB_PASS = 'password';
      $DB_NAME = 'databaseName';
  
      try{
          $DB_con = new PDO(&quot;mysql:host={$DB_HOST};dbname={$DB_NAME}&quot;,$DB_USER,$DB_PASS);
          $DB_con-&gt;setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
      }
      catch(PDOException $e){
          echo $e-&gt;getMessage();
      }
  ?&gt;
  </code></pre>