title: MySQL UPDATE statement is not updating database data through web form
body: <p><strong>Scenario:</strong> I have a web form where the user can manually enter data (see below). The user will submit the form and the data will be automatically added to the database.<br>
  <br /></p>
  
  <pre><code>date, order_ref, first_name, last_name, postcode, country, quantity, scott_packing, packing_price, courier_price, dispatch_type, job_status
  </code></pre>
  
  <p>On another page, the user will be able to only view all the jobs that are currently being (this data is taken from the database) processed and add the tracking number and edit the <code>packing_price,courier_price and job_status</code> and submit the new data.</p>
  
  <p><a href="http://i754.photobucket.com/albums/xx182/rache_R/Screenshot2014-04-23at104045_zps2a628d50.png" rel="nofollow">http://i754.photobucket.com/albums/xx182/rache_R/Screenshot2014-04-23at104045_zps2a628d50.png</a></p>
  
  <p><strong>Issue:</strong> When the user clicks the 'submit all' button, the user is supposed to be redirected to the thank you page which simply notifies the user that their entry has been successful however at the moment, the user is only directed to a blank page which contains the navigation menu. I have checked the database to see if the data has been updated but nothing has changed. How do i get my update statement to work so that the user can update the existing jobs?</p>
  
  <p>This is the code for the page that displays all the jobs: </p>
  
  <pre><code>        &lt;?
  session_start();
  
  if(!session_is_registered(myusername))
  {
      header("location:../index.php");
  }
  
  include("../template/header.php");
  include("../controllers/cn.php");
  
  $sql = "SELECT * FROM Jobs";
  $qry = mysql_query($sql);
  
  echo "&lt;div class='content'&gt;";
  echo "&lt;form class='form_edit' method='post' action='updatejob.php'&gt;";
  echo "&lt;table id='job_list' cellpadding='0' cellspacing='0'&gt;
  &lt;tr&gt;
  &lt;th&gt;Job No&lt;/th&gt;
  &lt;th&gt;Date&lt;/th&gt;
  &lt;th&gt;Qty&lt;/th&gt;
  &lt;th&gt;Postcode&lt;/th&gt;
  &lt;th&gt;Country&lt;/th&gt;
  &lt;th&gt;Packed by Scott&lt;/th&gt;
  &lt;th&gt;Packing Price&lt;/th&gt;
  &lt;th&gt;Courier Price&lt;/th&gt;
  &lt;th&gt;Tracking No&lt;/th&gt;
  &lt;th&gt;Dispatch Type&lt;/th&gt;
  &lt;th&gt;Job Status&lt;/th&gt;
  &lt;/tr&gt;";
  
  
  while($row = mysql_fetch_array($qry))
  {
      echo "&lt;tr&gt;";
      echo "&lt;td width='80' style='text-align: center;'&gt;" . $row['order_ref'] . "&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;" . $row['date'] . "&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;" . $row['quantity'] . "&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;" . $row['postcode'] . "&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;" . $row['country'] . "&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;&lt;input type='CHECKBOX' id='scott_packing' name='scott_packing' value='". $row['scott_packing'] . "'&gt;&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;&lt;input type='text' id='packing_price' name='packing_price' value='".  $row['packing_price'] . "'/&gt;&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;&lt;input type='text' id='courier_price' name='courier_price' value='". $row['courier_price']."'/&gt;&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;&lt;input type='text' id='tracking_number' name='tracking_number' value='". $row['tracking_number'] . "'/&gt;&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;" . $row['dispatch_type'] . "&lt;/td&gt;";
      echo "&lt;td width='100' style='text-align: center;'&gt;&lt;select name='job_status' id='job_status'&gt;
          &lt;option value='". $row['job_status'] ."'&gt;". $row['job_status']. " &lt;option value='dispatched'&gt;Dispatched&lt;/td&gt;";   
  
      //echo "&lt;td width='100' style='text-align: center;'&gt;&lt;a href='editjob.php'&gt;edit&lt;/td&gt;";
  
      echo "&lt;/tr&gt;";
  }
  
  echo "&lt;/table&gt;";
  echo "&lt;input type='submit' name='submit' value='submit all'/&gt;";
  echo "&lt;/form&gt;";
  
  mysql_close();
  
  
  ?&gt;
  </code></pre>
  
  <p>And here is the code that is supposed to update the data: </p>
  
  <pre><code>    &lt;?
  session_start();
  
  if(!session_is_registered(myusername)){
  header("location:../index.php");
  
  }
  
  include("../template/header.php");
  include("../controllers/cn.php");
  
  if (isset($_POST['submit']))
  {
      $order_ref = $_POST['order_ref'];
      $packing_price = $_POST['packing_price'];
      $courier_price = $_POST['courier_price'];
      $tracking_number = $_POST['tracking_number'];
      $job_status = $_POST['job_status'];
  
      $sql_qry = "UPDATE Jobs SET '$packing_price, $courier_price, $tracking_number, $job_status' WHERE order_ref = '$order_ref'";
  
      $query = mysql_query($sql_query);
  
        if(!$query)
      {
          die('Could not update data' .mysql_error());
      } else
      {
          header("location: updatesuccess.php");
          exit;
      }
  
      mysql_close();
  
  }
  
  
  
  
  ?&gt;
  </code></pre>