title: MySQL DELETE Query not executing
body: <p>Let me break down this page for you guys.  Its called driver.php and the objective of this page is for a driver to pick up pending pick up requests from passengers (requests will show in options tags as their emails). THE ISSUE is that the DELETE QUERY is not working for some reason. I want to be able to delete the existing pickup request for table when a driver gets it. YES I've searched on this website for answers and google for help that is why I am posting here. Thank you all for your help.</p>
  
  <pre><code>&lt;? session_start(); ?&gt;
  &lt;?php
  
  if(!isset($_SESSION['driver'])) {
      header('Location: mobile.php');
      exit;
  }
  ?&gt;
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;script&gt;
  &lt;!--This redirects the user to our mobile view--&gt;
  if (navigator.userAgent.match(/(iPhone|iPod|iPad|Android|BlackBerry|IEMobile)/)) {
  
  } else {
    window.location = "http://tripozipo.com/index.php"; 
  }
  &lt;/script&gt;
  &lt;!--This is for mobile JQuery--&gt;
  &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
  &lt;link rel="stylesheet" href="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css"&gt;
  &lt;script src="http://code.jquery.com/jquery-1.11.3.min.js"&gt;&lt;/script&gt;
  &lt;script src="http://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"&gt;&lt;/script&gt;
  &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"&gt;&lt;/script&gt;
  &lt;link rel="stylesheet" type="text/css" href="css/jquery.timeentry.css"&gt; 
  &lt;script type="text/javascript" src="js/jquery.plugin.js"&gt;&lt;/script&gt; 
  &lt;script type="text/javascript" src="js/jquery.timeentry.js"&gt;&lt;/script&gt;
  
  &lt;?php
  $host="localhost"; // Host name 
  $username="fakename"; // Mysql username 
  $password="fakepass"; // Mysql password 
  $db_name="fakedbname"; // Database name 
  $tbl_name="pickuprequests"; // Table name 
  
  // Connect to server and select database.
  $link = mysql_connect("$host", "$username", "$password")or die("cannot connect"); 
  mysql_select_db("$db_name", $link)or die("cannot select DB");
  
  $email = $_POST['email'];
  
  //this query gets all the records from pickuprequests so we can use mysql fetch array to ouput
  //the emails (of ppl asking for rides) in the html option tags
  $search_for_email="SELECT * FROM $tbl_name";
  $result_for_email=mysql_query($search_for_locations, $link);
  
  //get all the data in the table assoc with the email that the driver chooses
  //this is so we can get the location assoc with the email for mailing purposes ect
  $search_for_loc="SELECT * FROM $tbl_name WHERE email = '$email'";
  $result_for_loc=mysql_query($search_for_loc, $link);
  
  //get the loc assoc with the email and set it to loc variable for mailing purposes ect
  $loc = mysql_fetch_array($result_for_loc);
  $loc = $loc['location'];
  
  //find how many rows are returned with that email assoc with that loc
  //because if there is already a duplicate pickup request we want to delete it
  $query="SELECT * FROM $tbl_name WHERE email = '$email' AND location = '$loc'";
  $queryresult = mysql_query($query, $link);
  $count=mysql_num_rows($queryresult);
  
  //this query is so we can delete the records from pickup assoc with email (person that request ride)
  $delete_query = "DELETE * FROM pickuprequests WHERE email = $email";
  
  /* THIS IS CODE THAT HAS BEEN COMMENTED OUT
  $altloc = $_POST['altloc'];
  $time = $_POST['time'];
  */
  $msg = "Your driver is on the way! You will receive one last email when the driver arrives.";
  $subject = "Pickup Request";
  $mailheaders = "From: TripoZipo &lt;tripozipo.com&gt; \r\n";
  
  $driver = $_SESSION['driver'];
  
  //When the driver chooses a pickup request and hits submit then delete the pick up request from the table
  //'pickuprequests' so that another driver cant choose it, because its already been accepted
  
  if(isset($_POST['submit']) &amp;&amp; isset($_POST['email'])) {
      //if we find data in row return then there must already be a pick request
      //if there is then we want to delete that request but its not working
      if($count) {
      mysql_query($delete_query, $link);
      /* THIS IS CODE THAT HAS BEEN COMMENTED OUT
      mail($email, $subject, $msg, $mailheaders);
      mail($driver, "Pickup Address", "Here is the location: ".$loc, $mailheaders);
      echo "&lt;script type='text/javascript'&gt; document.location = 'http://mobile.tripozipo.com/confirmation.php'; &lt;/script&gt;";
      */
      }
      else
      /* THIS IS CODE THAT HAS BEEN COMMENTED OUT
      mail($email, $subject, $msg, $mailheaders);
      mail($driver, "Pickup Address", "Here is the location: ".$loc, $mailheaders);
      echo "&lt;script type='text/javascript'&gt; document.location = 'http://mobile.tripozipo.com/confirmation.php'; &lt;/script&gt;";
      */
      }
  
  ?&gt;
  
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div data-role="page"&gt;
    &lt;div  class="ui-content" align="center"&gt;
    &lt;img src="images/logo.png" style="height:100px; width: 202px;"&gt;
      &lt;h2&gt;Hello &lt;?php echo("{$_SESSION['driver']}"); ?&gt;, welcome to your dashboard&lt;/h2&gt;
  
      &lt;form method="post" action="driver.php" data-ajax="false"&gt;
        &lt;label for="location"&gt;Here are some pending pickups&lt;/label&gt;
        &lt;select name="email"&gt;
          &lt;?php while ($row1=mysql_fetch_array($result_for_email)) {
              $title = $row1['email'];
              echo "&lt;option&gt;$title&lt;/option&gt;";
          }
          ?&gt;
        &lt;/select&gt;
        &lt;?php 
          if(isset($_POST['submit'])) {
          if(!$count) {
          echo "&lt;b style='color: red;'&gt;Oops! It looks like someone else took it&lt;/b&gt;";
          }}?&gt;
        &lt;input type="submit" name="submit" value="Take"&gt;
        &lt;p align="center"&gt;Or&lt;/p&gt;
        &lt;a href="logout.php"&gt;&lt;input type="button" value="Log Out"&gt;&lt;/a&gt;
        &lt;a href="mobile.php"&gt;&lt;input type="button" value="Back"&gt;&lt;/a&gt;
  
      &lt;/form&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>