title: Simple PHP registration form - worked for months, changed nothing, now mysql INSERT fails
body: <p>This registration form worked like a charm for months. I have changed nothing. Now, it gets through all the conditionals of duplicate name, email, and the password check, and then fails to <code>INSERT</code> mysql and returns the <code>"An error has occurred. Your account was not created."</code> I don't see why. Has syntax changed or what?</p>
  
  <pre><code>    &lt;div id="backdrop"&gt;&lt;/div&gt;
      &lt;div id="register"&gt;    
      &lt;img src="http://www.staketheclaim.com/wp-content/themes/retlehs-roots-c526a84/dropbox/2012/rotate/header&lt;?php echo(rand(1,4)); ?&gt;.png" style="margin-left: -25px;margin-top: -20px;" /&gt;
      &lt;div id="regi" style="width:400px;float: right;"&gt;
      &lt;?php 
          if ($username &amp;&amp; $userid) {
           echo "&lt;div id='log-re' style='margin-left: 6px;width: 413px;'&gt;&lt;h2&gt;You must logout to register a new account. Not your Account?&lt;/h2&gt;" . "&lt;br /&gt;&lt;br /&gt;&lt;div id='cta'&gt;&lt;a href='http://www.staketheclaim.com/logout/' class='button' style='padding-left: 36px;font-size: 24px;top: 2px;right: -160px;'&gt;Logout Now&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;";    
          }
           else {
      if ($_POST['registerbtn']) {
           $getuser = $_POST['user'];
           $getemail = $_POST['email'];
           $password = $_POST['pass'];
           $getretypepass = $_POST['retypepass'];
           if ($getuser) {
               if(strpos($getuser, ' ') &gt; 0 == false ){
               if ($getemail) {
                     if ($password) {
                           if ($getretypepass) {
                                  if ( $password === $getretypepass) {
                                        if ( (strlen($getemail) &gt;= 7) &amp;&amp; (strstr($getemail, "@")) &amp;&amp; (strstr($getemail, "."))){
                                              require("base.php");
                                              $query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
                                              $numrows = mysql_num_rows($query);
                                              if ($numrows == 0) {
                                                   $query = mysql_query("SELECT * FROM users WHERE email='$getemail'");
                                              $numrows = mysql_num_rows($query);
                                              if ($numrows == 0) {
                                                  $password = md5(md5("ss3verds4g".$password."ss357rd5sg"));
                                                  $date = date("F d Y");
                                                  $code = md5(rand());
                                          $bio = "Bio";
                                      $location = "Location";
                                                  mysql_query("INSERT INTO users VALUES (
                                                                '','$getuser', '$password', '$getemail', '0', '$code', '$date', '$bio', '$location', '1'
                                                           )");
                                                           $query = mysql_query("SELECT * FROM users WHERE username='$getuser'");
                                                           $numrows = mysql_num_rows($query);
                                                           if  ($numrows == 1){
                                                                 $site = "http://www.staketheclaim.com";
                                                                 $webmaster = "noreply &lt;noreply@staketheclaim.com&gt;";
                                                                  $headers = "From: $webmaster";
                                                                   $subject = "Activate Your Account";
                                                                   $message  = "Thanks for registering. Click the link below to activate your account.\n";
                                                                   $message .= "$site/activate/?user=$getuser&amp;code=$code\n";
                                                                   $message .= "You must activate your account to login.";
                                                                   if (mail($getemail, $subject, $message, $headers )) {
                                                                            $errormsg = "You have been registered. You must activate your account from the activition link send to &lt;b&gt;$getemail&lt;/b&gt;.";
                                                                            $getuser = "";
                                                                            $getemail = "";
                                                                       }
                                                                          else 
                                                               else 
                                                                     $errormsg ="An error has occured. Your account was not created.";
                                              }
                                              else
                                                  $errormsg ="Their is already a user with that email.";
                                              }
                                              else
                                                  $errormsg ="Their is already a user with that username.";
                                              mysql_close;
                                              }
                                              else
                                                  $errormsg = "You must enter a valid email address to register.";
                                    }
                                    else
                                       $errormsg = "Your passwords did not match.";
                        } else 
                                $errormsg = "You must retype you password to register.";
                  } else 
                         $errormsg = "You must enter a password to register.";
              } else
                    $errormsg = "You must enter you email to register.";
           } else
                $errormsg = "Your username cannot have any spaces.&lt;br /&gt;";
        } else
            $errormsg = "You must enter a username to register.&lt;br /&gt;";
      } $form = "&lt;form action='' method='post' style='margin-top:-20px;'&gt;
      &lt;h2&gt;Sign up for StakeTheClaim™.&lt;br /&gt; It's free!&lt;/h2&gt;
      &lt;br /&gt;
      &lt;font color='red'&gt;$errormsg&lt;/font&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      Username:
      &lt;br /&gt;
      &lt;input type='text' name='user' value='$getuser' style='' /&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      Email:
      &lt;br /&gt;
      &lt;input type='text' name='email' value='$getemail' /&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      Password:
      &lt;br /&gt;
      &lt;input type='password' name='pass' value='' /&gt;
      &lt;br /&gt;
      &lt;br /&gt;
      Re-Password:
      &lt;br /&gt;
      &lt;input type='password' name='retypepass' value='' /&gt;
      &lt;br /&gt;
      &lt;input type='submit' name='registerbtn' value='Register' /&gt;
      &lt;/form&gt;";
      echo $form;
      }
      ?&gt;&lt;/div&gt;&lt;/div&gt;
  </code></pre>