title: sqlite3_step(statement) == SQLITE_DONE is always false
body: <p>I am trying to Sign up a user in my application.<br>I have a view controller with <code>3 textfields (username, password and confirmpassword)</code> and a <code>submit</code> button.</p>
  
  <p>The following method is called when submit button is pressed:</p>
  
  <pre><code>-(IBAction)addUser
  {
      NSString *tempUser,*tempPass, *tempConfPass;
      tempUser = [[NSString alloc]init];
      tempPass = [[NSString alloc]init];
      tempConfPass = [[NSString alloc]init];
      tempUser = [NSString stringWithFormat:@"%@",_mUserName.text];
      tempPass = [NSString stringWithFormat:@"%@",_mPassword.text];
      tempConfPass = [NSString stringWithFormat:@"%@",_mConfPassword.text];
      signupUser = [[UseDb alloc]init];
  
      flagUser = [signupUser addNewUser:_mUserName.text:_mPassword.text:_mConfPassword.text];
      if(flagUser)
      {
          myAlertViewUser = [[UIAlertView alloc] initWithTitle:@"Error" message:@"User Added"
                                                      delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
  
          [myAlertViewUser show];
      }
      else {
         _mStatus.text = @"failed to add user";
         myAlertViewUser = [[UIAlertView alloc] initWithTitle:@"Error" message:@"passwords don't match"
                                  delegate:nil cancelButtonTitle:@"OK" otherButtonTitles: nil];
  
         [myAlertViewUser show];
      }
  }
  </code></pre>
  
  <p>and this method is called by <code>addUser</code> method:</p>
  
  <pre><code>-(BOOL)addNewUser:(NSString *)newUser :(NSString *)newPassword :(NSString *)confirmPass
  {
     NSLog(@"%@....%@...%@",newUser, newPassword, confirmPass);
      sqlite3_stmt    *statement;
      const char *dbpath = [_mDatabasePathDb UTF8String];
  
      if (sqlite3_open(dbpath, &amp;_mDb) == SQLITE_OK &amp;&amp; [newPassword isEqualToString:confirmPass] &amp;&amp; ![newUser isEqualToString:@""] &amp;&amp; ![newPassword isEqualToString:@""])
      {
          self.userName = [NSString stringWithFormat:@"%@",newUser];
          self.password = [NSString stringWithFormat:@"%@",newPassword];
  
          NSString *insertSQL = [NSString stringWithFormat:
                                 @"INSERT INTO USERDETAIL VALUES (\"%@\",\"%@\",\"%@\", \"%@\",\"%@\", \"%@\",\"%@\", \"%@\",\"%@\", \"%@\",\"%@\")",self.userName,self.password,@"",@"",@"",@"",@"",@"",@"",@"",@"" ];
  
          NSLog(@"%@",insertSQL);
          const char *insert_stmt = [insertSQL UTF8String];
          sqlite3_prepare_v2(_mDb, insert_stmt, -1, &amp;statement, NULL);
  
          if (sqlite3_step(statement) == SQLITE_DONE)
          {
              return YES;
              /*    mUserName.text = @"";
               mPassword.text = @"";
               mConfPassword.text = @""; */
  
          }
          else {
  
              NSLog(@"failed to add user");
          }
  
          sqlite3_finalize(statement);
          sqlite3_close(_mDb);
      }
  }
  </code></pre>
  
  <p>In the <code>addNewUser</code> method,  <code>if (sqlite3_step(statement) == SQLITE_DONE)</code> is always coming out to be <code>false</code>, statement has some value before </p>
  
  <pre><code>sqlite3_prepare_v2(_mDb, insert_stmt, -1, &amp;statement, NULL); 
  </code></pre>
  
  <p>but turns to <code>nil</code> after the above statement is executed. I don't understand why that is happening.<br>Please help.</p>