title: using _GET url link to delete a record from mysql database
body: <p><strong>EDIT</strong></p>
  
  <p>Thanks for the help so far. I have edited my post to reflect the changes suggested below. I am using PDO for my database connection. The code I have now is as follows:</p>
  
  <p><strong>HTML</strong></p>
  
  <pre><code>&lt;a href="includes/delete-customer.php?userID='.$row-&gt;customer_id.'"&gt;
  </code></pre>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>    &lt;?php
  
      //MySQL Database Connect
      include 'includes/config.php';
  
          // confirm that the 'id' variable has been set
          if (isset($_GET['userID']) &amp;&amp; is_numeric($_GET['userID']))
          {
                  // get the 'id' variable from the URL
                  $id = $_GET['userID'];
  
                  /* Delete row from the customer table */
                  $id = $dbh-&gt;exec("DELETE FROM customer WHERE customer_id = '$id'");
  
                  $stmt-&gt;execute();
          }
  ?&gt;
  </code></pre>
  
  <p><strong>config.php</strong></p>
  
  <pre><code>&lt;?php
  
  /*** mysql hostname ***/
  $hostname = 'localhost';
  
  /*** mysql username ***/
  $username = 'user';
  
  /*** mysql password ***/
  $password = 'password';
  
  try {
      $dbh = new PDO("mysql:host=$hostname;dbname=testDB", $username, $password);
      }
  catch(PDOException $e)
      {
      echo $e-&gt;getMessage();
      }
  ?&gt;
  </code></pre>
  
  <p>I'm pretty sure the HTML is correct now and the issue lies with the delete-customer.php file. I am currently receiving the following error: Fatal error: Call to a member function exec() on a non-object</p>
  
  <p>I'm not sure of how to implement the PDO query correctly. Any further advice is much appreciated. </p>