title: PHP/MySQL Delete Record doesn't Delete
body: <p>This is driving me crazy! I have a webpage called course listing where I am using PHP to create a HTML table listing the courses stored in a MySQL database (using Wampserver)</p>
  
  <pre><code>&lt;?php
  
  require "dbconn.php";
  
  $query = "SELECT coursecode, coursename FROM course";
  
  $results = $connect-&gt;query($query);
  
  $numrow = $results-&gt;num_rows;
  ?&gt;
  
  &lt;html&gt;
    &lt;head&gt;&lt;/head&gt;
      &lt;body&gt;
        &lt;table border="1"&gt;
  
          &lt;?php
          $count = 0;
          while ($count &lt; $numrow)
              {
                  $row = $results-&gt;fetch_assoc();
                  extract($row);
  
                  echo "&lt;tr&gt;";
  
                  echo "&lt;td&gt;";
                  echo "&lt;a href='updatecourseform.php?coursecode=".$coursecode."'&gt;".$coursecode."&lt;/a&gt;";
  
                  echo "&lt;td&gt;";
                  echo $row['coursename'];
                  echo "&lt;/td&gt;";
  
                  echo "&lt;td&gt;";
                  echo "&lt;a href='deletecourse.php?coursecode=".$coursecode."'&gt;Delete&lt;/a&gt;";
                  echo "&lt;/td&gt;";
  
                  echo "&lt;/tr&gt;";
  
                  $count = $count + 1;
              }
          ?&gt;
  
          &lt;/table&gt;
          &lt;br /&gt;
          The number of courses found was: &lt;?php echo $numrow; ?&gt;
          &lt;br /&gt;&lt;br /&gt;
          Click &lt;a href="addcourse.html"&gt;here&lt;/a&gt; if you want to add a Course
      &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>and this prints out a nice HTML table with all the data correctly in it, and a row on the right with the word Delete which is a hyperlink and should allow me to delete a course. But when I click Delete, it doesn't Delete! Here is my deletecourse.php.</p>
  
  <pre><code>&lt;?php
  
  require "dbconn.php";
  
  $coursecode = $_GET['coursecode'];
  
  $query = "DELETE FROM course WHERE coursecode =".$coursecode;
  
  $results = $connect-&gt;query($query);
  
  header("Location: courselisting.php");
  ?&gt;
  </code></pre>
  
  <p>This is super frustrating because I have the exact same example working for a different database... I've just switched out all the variable names, but essentially the logic and syntax and everything is the same!</p>