title: Xcode login screen sqlite3 database authentication issue
body: <p>I am trying to create a login screen for an iphone application using sqlite3 to store the login credentials. </p>
  
  <p>The following is the function I am using to handle the authentication:</p>
  
  <pre><code>-(void) enter
  {
      const char *dbpath = [databasePath UTF8String];
      sqlite3_stmt    *statement;
  
      if (sqlite3_open(dbpath, &amp;DBLogin) == SQLITE_OK)
      {
          NSLog(@"Connected to Database");
          NSString *querySQL = [NSString stringWithFormat:@"SELECT id FROM User WHERE id=\"%@\"",login.text];
          NSString *s = password.text;
          const char *query_stmt = [querySQL UTF8String];
          NSLog(@"String is %s",query_stmt);
          NSLog(@"Pass is %@",s);
          if (sqlite3_prepare_v2(DBLogin,query_stmt, -1, &amp;statement, NULL) ==!SQLITE_NULL)
          {
              NSLog(@"Executed Correctly");
              querySQL = [NSString stringWithFormat:@"SELECT password FROM User WHERE password=\"%@\"",password.text];
              query_stmt = [querySQL UTF8String];
              const char *f= [login.text UTF8String];
              NSLog(@"String is %s",query_stmt);
              NSLog(@"Pass is %@",s);
              //   const char *l = [login.text UTF8String];
              //  sqlite3_bind_text(statement, 1, query_stmt, -1, SQLITE_STATIC);
              if (sqlite3_prepare_v2(DBLogin,query_stmt, -1, &amp;statement, NULL) == !SQLITE_NULL)
              {
                  if(sqlite3_bind_text(statement, 1,f , -1, SQLITE_STATIC))
                      status.text= @"Congratulations";
              }
              else
              {
                  NSLog(@"error");
              }
          }
          else
          {
              NSLog(@"Failed");
              status.text =@"ERROR!";
          }
      }
  }
  </code></pre>
  
  <p>And this is my schema for the database:</p>
  
  <p><code>CREATE TABLE User (id varchar(20) PRIMARY KEY, password varchar(20));</code></p>
  
  <p>I think there is something wrong with the way I am passing the details of <code>login.text</code> or <code>password.text</code>. According to <code>NSLog</code> it passes the right values but it seems to fail to check whether it is the right input or not. It seems to think everything is good and displays <code>status.text = Congratulations</code> no matter what I input.</p>
  
  <p>I don't have any idea how to fix this and would appreciate any help I can get. I can provide more information if needed. Thanks in advance!</p>