How can Update account which corresponds with the Pin inputted?
<p>I have this Alumni Directory System that when users wants to join the site ..he/she will input the correct pin for his/her account..IF the pin was correct ..he will be directed to the account creation page which includes: username,password and email.. this inputs will be updated to his existing record on the database..heres the scripts that ive been using ..and got problem on how to update the inputs of the user to the database..</p>

<p>verify.php</p>

<pre><code>&lt;?php

// Start Session to enable creating the session variables below when they log in session_start();
include 'scripts/connect_to_mysql.php';
// Connect to the database
// Force script errors and warnings to show on page in case php.ini file is set to not display them
error_reporting(E_ALL);
ini_set('display_errors', '1'); ?&gt; &lt;?php //

//Initialize some vars

?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; 
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
    &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"/&gt;
    &lt;link href="stylesheets/style.css" rel="stylesheet" type="text/css"/&gt;
    &lt;title&gt;Enter Your Pin&lt;/title&gt;
&lt;body&gt;
&lt;div id="main_content"&gt;
    &lt;form id="form1" name="form1" method="post" action="createaccount.php" style="height: 96px;"&gt;
        &lt;label&gt;Confirmation Number:
            &lt;input type="text" name="confirm" id="ed"/&gt; &lt;/label&gt;

        &lt;p&gt;
            &lt;input name="" type="submit" value="Log-in" id="button1"/&gt;
        &lt;/p&gt;
    &lt;/form&gt;
</code></pre>

<p>createaccount.php</p>

<pre><code>&lt;?php
include_once "scripts/connect_to_mysql.php";
$confirm = $_POST['confirm'];
$result = mysql_query("SELECT * FROM myMembers where confirmation='$confirm'");
while($row = mysql_fetch_array($result))
  {     
    $id = $row['id'];
    $username = $row['username'];
    $password = $row['password'];
    $email = $row['email'];
  } 
  ?&gt;
    &lt;?php

    if (isset ($_POST['username'])){

     $username = preg_replace('#[^A-Za-z0-9]#i', '', $_POST['username']); // filter everything but letters and numbers

     $email = $_POST['email'];
     $password = $_POST['password'];

     $email = stripslashes($email); 
     $password= stripslashes($password); 

     $email = strip_tags($email);
     $password= strip_tags($password);

     // Connect to database
     include_once "scripts/connect_to_mysql.php";
     $emailCHecker = mysql_real_escape_string($email);
     $emailCHecker = str_replace("`", "", $emailCHecker);
     // Database duplicate username check setup for use below in the error handling if else conditionals
     $sql_uname_check = mysql_query("SELECT username FROM myMembers WHERE username='$username'"); 
     $uname_check = mysql_num_rows($sql_uname_check);
     // Database duplicate e-mail check setup for use below in the error handling if else conditionals
     $sql_email_check = mysql_query("SELECT email FROM myMembers WHERE email='$emailCHecker'");
     $email_check = mysql_num_rows($sql_email_check);

     // Error handling for missing data
     if ((!$username) || (!$email) || (!$password)) { 

     $errorMsg = 'ERROR: You did not submit the following required information:&lt;br /&gt;&lt;br /&gt;';
    }
     if(!$username){ 
       $errorMsg .= ' * User Name&lt;br /&gt;';
     } 

     if(!$email){ 
       $errorMsg .= ' * Email Address&lt;br /&gt;';      
     }
     if(!$password){ 
       $errorMsg .= ' *  Password&lt;br /&gt;';      

     } else if (strlen($username) &lt; 4) {
               $errorMsg = "&lt;u&gt;ERROR:&lt;/u&gt;&lt;br /&gt;Your User Name is too short. 4 - 20 characters please.&lt;br /&gt;"; 
     } else if (strlen($username) &gt; 20) {
               $errorMsg = "&lt;u&gt;ERROR:&lt;/u&gt;&lt;br /&gt;Your User Name is too long. 4 - 20 characters please.&lt;br /&gt;"; 
     } else if ($uname_check &gt; 0){ 
              $errorMsg = "&lt;u&gt;ERROR:&lt;/u&gt;&lt;br /&gt;Your User Name is already in use inside of our system. Please try another.&lt;br /&gt;"; 
     } else if ($email_check &gt; 0){ 
              $errorMsg = "&lt;u&gt;ERROR:&lt;/u&gt;&lt;br /&gt;Your Email address is already in use inside of our system. Please use another.&lt;br /&gt;"; 
     } else { // Error handling is ended, process the data and add member to database
     ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    }

     $username = mysql_real_escape_string($username);
     $email = mysql_real_escape_string($email);
     $password = mysql_real_escape_string($password);

     // Add MD5 Hash to the password variable
     $db_password = md5($password); 

     // GET USER IP ADDRESS
     $ipaddress = getenv('REMOTE_ADDR');
          // Add user info into the database table for the main site table
     $sql = mysql_query("UPDATE myMembers SET username='$username', email='$email', password='$db_password', ipaddress='ipaddress', sign_up_date WHERE confirmation='$confirm'");
        }         





?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
&lt;head&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /&gt;
&lt;title&gt;Create Account | &lt;?php echo $MySocialSitename; ?&gt;&lt;/title&gt;
&lt;link href="style/main.css" rel="stylesheet" type="text/css" /&gt;
&lt;script src="js/jquery-1.4.2.js" type="text/javascript"&gt;&lt;/script&gt;
&lt;script language="javascript" type="text/javascript"&gt; 
$(document).ready(function() {
    $("#username").blur(function() {
        $("#nameresponse").removeClass().text('Checking Username...').fadeIn(1000);
        $.post("scripts/check_signup_name.php",{ username:$(this).val() } ,function(data) {
            $("#nameresponse").fadeTo(200,0.1,function() { 
              $(this).html(data).fadeTo(900,1); 
            });
        });
    });
});
function toggleSlideBox(x) {
        if ($('#'+x).is(":hidden")) {
            $('#'+x).slideDown(300);
        } else {
            $('#'+x).slideUp(300);
        }
}
&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;br /&gt;&lt;br /&gt;
&lt;table class="mainBodyTable" border="0" align="center" cellpadding="0" cellspacing="0"&gt;
  &lt;tr&gt;
    &lt;td width="738" valign="top"&gt;

        &lt;h2 style="margin-left:80px;"&gt;Create Your Account &lt;/h2&gt;
     &lt;table width="600" align="center" cellpadding="8" cellspacing="0" style="border:#999 1px solid; background-color:#FBFBFB;"&gt;
&lt;form action="createaccount.php" method="post" style="margin-top: -31px;"  name="personal"&gt;

    &lt;tr&gt;
            &lt;td colspan="2"&gt;&lt;font color="#FF0000"&gt;&lt;?php print "$errorMsg"; ?&gt;&lt;/font&gt;&lt;/td&gt;
    &lt;/tr&gt;       
    &lt;tr&gt;

     &lt;tr&gt;
            &lt;td width="114" bgcolor="#FFFFFF"&gt;User Name:&lt;span class="brightRed"&gt; *&lt;/span&gt;&lt;/td&gt;
            &lt;td width="452" bgcolor="#FFFFFF"&gt;&lt;input name="username" type="text" class="formFields" id="username" value="&lt;?php echo $username;?&gt;" size="32" maxlength="20" /&gt;&lt;br /&gt;
              &lt;span id="nameresponse"&gt;&lt;span class="textSize_9px"&gt;&lt;span class="greyColor"&gt;Alphanumeric Characters Only&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/td&gt;
          &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;div align="right" class="style1"&gt;Password:&lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input name="password" type="password" class="ed" id="last" size="40" value="" /&gt;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;div align="right" class="style1"&gt;Email Address:&lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input name="email" type="text" class="ed" id="address" size="40" value="" /&gt;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;tr&gt;
      &lt;td&gt;&lt;div align="right"&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;td colspan="2"&gt;&lt;label&gt;
      &lt;input type="checkbox" name="condition" value="checkbox" /&gt;
      &lt;span class="style1"&gt;&lt;small&gt;i agree the &lt;a rel="facebox" href="terms_condition.php"&gt;terms and condition&lt;/a&gt; of this alumni&lt;/small&gt;&lt;/span&gt;&lt;/label&gt;&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
      &lt;td&gt;&lt;div align="right"&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;td&gt;&lt;input name="but" type="submit" value="Confirm" /&gt;&lt;/td&gt;
      &lt;td&gt;&amp;nbsp;&lt;/td&gt;
    &lt;/tr&gt;
    &lt;/table&gt;
&lt;/form&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>after the update was finished it will direct the user to the login page.. thanks and Godbless.. Cheers</p>
