title: php update query not updating database
body: <p>I am trying to update my database using a php file that has an html form in it. 
  When I hit 'update' in the url bar, the updated information is showing. But when I go back to my HTML page that shows me everything in my database, it still has the old information. </p>
  
  <p>What am I not doing?</p>
  
  <p><strong>I know there are security issues</strong>, like not using a session, or sanitizing the data, or using my_sql in general. <strong>This is just for a school project.</strong> After the semester I will be closing the hosting account. </p>
  
  <p>EDIT: I moved the "$id = $_GET['id'];" line above the update query so that "$id" would be defined before query. Updated code.</p>
  
  <p>EDIT2: After following the comments about turning on errors and displaying them after the update query. It showed that the ID was not in fact being read back in. So I added a hidden input value for the ID to give back to the file after the submit button was it. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  error_reporting(E_ALL &amp; ~E_DEPRECATED); 
  ini_set('display_errors', 1); 
  
  $host = 'hose';
  $user = 'user';
  $pass = 'pass';
  $database = 'database';
  $table = 'table';
  
  //connecting to server
  $conn = mysql_pconnect($host,$user,$pass); 
  
  //opening to database
  if (!($db = mysql_select_db($database))) {
   echo "Could NOT connect to database.";
  }
  
  //gathering new data from update form
  if (isset($_GET['submit'])) {
   $title= $_GET['title'];
   $year = $_GET['year'];
   $director = $_GET['director'];
   $genre = $_GET['genre'];
   $runtime = $_GET['runtime'];
   $id = $_GET['id'];
   $query = mysql_query("UPDATE `collection`
           SET `title`='$title', `year`='$year', `director`='$director', `genre`='$genre', `runtime`='$runtime' 
           WHERE `ID`='$id'");
  }
  
  //passing in ID number and running query
  $id = $_GET['id'];
  $query = "SELECT * FROM '$table' WHERE ID = '$id'";
  $result = mysql_query($query);
  if (!$result) {
   echo 'Could not run query: ' . mysql_error();
   exit;
  }
  
  //getting row data for ID number
  $row = mysql_fetch_array( $result );
  
  ?&gt;
  
  &lt;!DOCTYPE html&gt;
  &lt;html&gt;
     &lt;head&gt;
   &lt;meta content="text/html;charset=utf-8" http-equiv="Content-Type"&gt;
   &lt;meta content="utf-8" http-equiv="encoding"&gt;
   &lt;title&gt;title&lt;/title&gt;
   &lt;meta name="viewport" content="width=device-width, initial-scale=1"&gt;
   &lt;link rel="stylesheet" href="webpage.css"&gt;
   &lt;style type = "text/css"&gt;
    table, th, td {
         border: 0px solid black;
         border-collapse: collapse;
     }
    table {
     margin: auto;
     width: 50%;
     }
    td {
         padding: 5px;
     }
    img {
     text-decoration:  none;
    }
   &lt;/style&gt;
     &lt;/head&gt;
     &lt;body class="subStyle"&gt;
     
      &lt;div class="topnav"&gt;
      &lt;a href="#"&gt;Home&lt;/a&gt;
      &lt;a href="#"&gt;Database&lt;/a&gt;
      &lt;a href="#"&gt;Insert&lt;/a&gt;
   &lt;/div&gt;
   
   &lt;form class='form' method='get'&gt;
   &lt;table border=0&gt;
    &lt;tr&gt;
    &lt;th&gt;Movie Title&lt;/th&gt;
    &lt;th&gt;Year Made&lt;/th&gt;
    &lt;th&gt;Director&lt;/th&gt;
    &lt;th&gt;Genre&lt;/th&gt;
    &lt;th&gt;Runtime(Minutes)&lt;/th&gt;
    &lt;/tr&gt;
    
    &lt;tr&gt;
    &lt;td&gt;&lt;input type=text name="title"    id="title"    maxlength=100 size=50 value="&lt;?php echo $row['title']; ?&gt;"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type=text name="year"     id="year"     maxlength=4   size=10 value="&lt;?php echo $row['year']; ?&gt;"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type=text name="director" id="director" maxlength=100 size=30 value="&lt;?php echo $row['director']; ?&gt;"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type=text name="genre"    id="genre"    maxlength=20  size=20 value="&lt;?php echo $row['genre']; ?&gt;"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type=text name="runtime"  id="runtime"  maxlength=4   size=20 value="&lt;?php echo $row['runtime']; ?&gt;"&gt;&lt;/td&gt;
    &lt;td&gt;&lt;input type=hidden name="id"  id="id"  value="&lt;?php echo $row['ID']; ?&gt;"&gt;&lt;/td&gt;
    &lt;/tr&gt;
    
    &lt;tr&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;&lt;/td&gt;&lt;td&gt;
    &lt;button class='submit' type='submit' name='submit' value='update'&gt;Update Movie&lt;/button&gt;&lt;/td&gt;&lt;/tr&gt;
   &lt;/table&gt;
   &lt;/form&gt;
     &lt;/body&gt;
  &lt;/html&gt;
  
  &lt;?php
  
  //check if update worked
  if (isset($_GET['submit'])) {
   echo '&lt;div class="form" id="form3"&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;
   &lt;Span&gt;Data Updated Successfuly&lt;/span&gt;&lt;/div&gt;';
  }
  
  //close connection
  mysql_close($conn); 
  ?&gt;</code></pre>
  </div>
  </div>
  </p>