title: PHP MySQL DELETE row from html table with link button
body: <p>I've been looking at this for some time now, all I'm doing is learning PHP with mysql, with no previous programming experience before these so please be kind. I need to delete an entire row from a table. The table is inside <code>list.php</code> and there's a delete button that redirects to <code>delete.php</code>. But all it does it redirects me to a blank page with an url something like <code>"delete.php?id=4"</code> depending on row ID, which seems to be correct.</p>
  
  <p>This is <code>connect.php</code>: </p>
  
  <pre><code>&lt;?php 
  $server = "localhost";
  $db_user = "root";
  $db_pass = "";
  $db_name = "school";
  
  $db_conn = mysqli_connect($server, $db_user, $db_pass, $db_name);
  
  $connect_error = 'Sorry, we are experiencing connection problems';
  
  mysql_connect('localhost', 'root', '') or die($connect_error);
  mysql_select_db('school') or die($connect_error);
  
  ?&gt;
  </code></pre>
  
  <p>And this is <code>delete.php</code> :</p>
  
  <pre><code>&lt;?php 
  if(isset($_GET['ID'])){
      $courseID = $_GET['ID'];
      $sql_delete = "DELETE FROM Courses WHERE ID = $courseID";       
      print ($sql_delete);        
          $result = mysqli_query($db_conn,$sql_delete);
      if($result) {
          echo "Congratulations. You have deleted this course succesfully.";
          header('location:list.php');
      } else {
          echo "Error";
      error_reporting(E_ALL ^ E_DEPRECATED);
      }
  
  }
  ?&gt;
  </code></pre>
  
  <p>Notice  "<code>print ($sql_delete);</code>", which doesn't print anything either. All I can think of is there is something wrong with the way I am asking for the ID by using <code>$_GET</code>, but can't get my head around it. When I run </p>
  
  <blockquote>
  <pre><code>"DELETE FROM Courses WHERE ID = 4;"
  </code></pre>
  </blockquote>
  
  <p>inside xampp's mysql module, it works. Uhm... oh well.</p>
  
  <p>OK, let me add:
  This is actually my delete button inside list.php, which gives me an URL based on table row number, based on Course id.</p>
  
  <pre><code>&lt;?php echo "&lt;td&gt;&lt;a href=\"delete.php?id=$row[ID]\"&gt;Delete&lt;/a&gt;";?&gt;
  </code></pre>