Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4117112
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T22:47:39+00:00 2026-05-20T22:47:39+00:00

I am trying to create login page in my application. For that I am

  • 0

I am trying to create login page in my application. For that I am using sqlite database(journeymapper.db3 it is database name) which has UserInformation table
For that use the fowling code:

 -(void)checkindatabase
{
NSString *direct = [[NSString alloc]init] ;
NSString *dbPath = [direct stringByAppendingPathComponent:@"journeymapper.db3"];


if(sqlite3_open([dbPath UTF8String], &database) == SQLITE_OK)
{
    NSLog(@"open");
    NSString *sql = [[NSString alloc] initWithFormat:@"select Username='%@',Password='%@' from UserInformation",txtuser.text,txtpass.text];
    //[sql UTF8String];
        //NSLog(@"'%s'",[sql UTF8String]);
    sqlite3_stmt *statment;
    if(sqlite3_prepare_v2(database, [sql UTF8String], -1, &statment, NULL) == SQLITE_OK)
    {
         if(sqlite3_step(statment) == SQLITE_ROW)
         {

             UIAlertView* alert = [[UIAlertView alloc] initWithTitle:nil
                                                    message:@"Welcome to joureny" delegate:nil 
                                                   cancelButtonTitle:@"OK" otherButtonTitles:nil];
             [alert show];
             [alert release];  
         }


    }


    sqlite3_finalize(statment);

}
sqlite3_close(database);
}

-(IBAction)login
{
    [self checkindatabase]; 
}

I am entering right user name & password but it doesn’t show me the alertview how can I achieve this. Please help me on how I can create the login page.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T22:47:39+00:00Added an answer on May 20, 2026 at 10:47 pm

    May be 2 of ur assignment are incorrect.1. check dbpath and query

    1.

        NSArray *dirPath =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);
        NSString *docDir =[dirPath objectAtIndex:0];
        NSString *databasePath =[[NSString alloc] initWithString:[docDir stringByAppendingPathComponent:@"dbname.db"]];
    

    2.

    Change Your query as

    NSString *sql = [[NSString alloc] initWithFormat:@"select * from UserInformation where Username='%@' and Password='%@'",txtuser.text,txtpass.text];
    

    if it return some thing …Your username and password is correct .or else one of the text is in correct

    Edited Answer

     //To check open DB or not   
     if(open DB)
       //ur code
     else
      NSLog(@"open fails & error is ::%s",sqlite3_errmsg(contactDB));
    
     // To validate Password    
    
     if (sqlite3_prepare_v2(contactDB, [sql UTF8String], -1, &statement, NULL) == SQLITE_OK)
      {   if(sqlite3_step(statement) == SQLITE_ROW)
                { 
             //user name is correct
             //if u want to print in log use below code  
             NSString *username=[[NSString alloc] initWithUTF8String:(const char *)       sqlite3_column_text(statement,0)];  
             NSString *password = [[NSString alloc] initWithUTF8String:(const char *) sqlite3_column_text(statement,1)];
    
                }
           else    
             // Authentication failed
      }
    

    Best Regards,

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create a login page in iphone, using sqlite . I
I am trying to create a login page that will send the user to
Im trying to create a iPhone Objective C login page using PHP/MySQL to authenticate.
I'm trying to create an application that uses Google OAuth for login, and then
I'm trying to write an android application that has two main activities: login screen
Ok so I am trying create a login script, here I am using PHP5
I am new to zend. I am trying to create login form using zend
I'm trying to create a login system using PHP, and I'm not quite sure
What I'm trying to do I'm trying to create a Login which is fully
I am trying to create an application on BlackBerry 9930 simulator that authenticate the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.