title: Update Mysql column field based on email address
body: <p>My DB has columns: ID, first_name, email, password, level</p>
  
  <p>I have a form that i am trying to update the 'level' column based on the 'email address' entered of the existing user.</p>
  
  <p>Right now i have a basic form that just inserts the info, but i need it to update existing users based on the email value.</p>
  
  <p>This is what i have</p>
  
  <pre><code>&lt;form action="update.php" method="post"&gt;
  
  &lt;input type="hidden" name="action" value="update" /&gt;
  
  &lt;fieldset&gt;
  &lt;label  for="email" /&gt;Email Address:&lt;/label&gt;
  &lt;input  value="" type="text" name="email" id="email" /&gt;
  &lt;label  for="level" /&gt;Level:&lt;/label&gt;
  &lt;input  value="vip" type="text" name="level" id="level" /&gt;
  &lt;input class="button" type="image" src="/img/right/get-started-button.png" /&gt;
  &lt;/fieldset&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>----update.php------</p>
  
  <pre><code>&lt;?php
  $email = $_POST['email'];
  $level = $_POST['level'];
  
  mysql_connect ("localhost", "username", "pass") or die ('Error: ' . mysql_error());
  mysql_select_db ("db_name");
  
  $query="INSERT INTO users (email, level)VALUES ('".$email."','".$level."')";
  
  mysql_query($query) or die ('Error updating database');
  
  echo "Database Updated With: " .$email. " ".$level ;
  
  ?&gt;
  </code></pre>