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

  • Home
  • SEARCH
  • 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 689455
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T02:20:02+00:00 2026-05-14T02:20:02+00:00

I am new to using the SQLite database in iphone apps. I have created

  • 0

I am new to using the SQLite database in iphone apps. I have created a database with login table in it and added the database to the project. Login table contains 3 fields ID, Username and Password fields. I am entering the username and password in the textfields of the view. Now I am looking of how to retrieve the id from the login table when username and password entered are correct by checking the table. Can anyone help out in this.

My Code:

-(void)checkInDatabase
{
    if(sqlite3_open([databasePath UTF8String], &database) == SQLITE_OK)
    {
        //uid = "select count(*) from logins where Username==txtusername.text and Password==txtpassword.text";
        NSString* sql =[[NSString alloc] initWithFormat:@"select id from login where Username =%s and Password=%s;",txtusername.text,txtpassword.text];

        [sql UTF8String];
        sqlite3_stmt *statement;
        if(sqlite3_prepare_v2(database, sql, -1, &statement, NULL) == SQLITE_OK)
        {
            if(sqlite3_step(statement) == SQLITE_ROW);
            {
                uid =[NSString stringWithUTF8String:(char*)sqlite3_column_text(statement, 1)]; 
            }
        }
        else
        {
            uid =0;
        }
        sqlite3_finalize(statement);
    }
    sqlite3_close(database);
}
  • 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-14T02:20:03+00:00Added an answer on May 14, 2026 at 2:20 am

    I got it working by writing the code like this:

    NSString* sql = [[NSString alloc] initWithFormat:
                                      @"select id from login where Username='%@' and  
                                      Password='%@'",txtusername.text,txtpassword.text];
    

    Its working good for me now.

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

Sidebar

Related Questions

I have an iPhone app that is using sqlite 3.6 (not with FMDB) to
I have a program that accesses a database using SQLite. When I open a
I still very new using Subversion. Is it possible to have a working copy
I have a question about using new[] . Imagine this: Object.SomeProperty = new[] {string1,
I am new to iPad/iPhone apps/games development. I am developing a game. The game
I am developing mobile application in C#. I am using the SQLite database to
I'm new to using the NetBeans IDE. When I try to look at the
I'm new to using LINQ to Entities (or Entity Framework whatever they're calling it)
I am fairly new to using infragistics controls (started yesterday). While they are (very)
I am relatively new to using jQuery and would like to use the load

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.