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 1023813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T11:41:01+00:00 2026-05-16T11:41:01+00:00

I have a table having data. id type 1 max 1 sam 1 rom

  • 0

I have a table having data.

id type
1  max
1  sam
1  rom
2  jak

I want to retrieve all the type where id=1;

if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {
            while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
                NSString *aRecord = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)];
                NSLog (@"%@",aRecord);
            }

this statement retrive me only the last record. How can i get all the records?

how to catch these records in the variable. I am using aRecord but it store only last record. So this is the main concern
  • 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-16T11:41:02+00:00Added an answer on May 16, 2026 at 11:41 am

    The sql ro do this is simply:

    select * from <table_name> where id = 1 
    

    do something like this:

    NSMutableString *myRecords = [NSMutableString initWithString:@""];
    
    if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL) == SQLITE_OK) {   
                while(sqlite3_step(compiledStatement) == SQLITE_ROW) {
                    NSString *aRecord = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 0)];        
    
                    myRecords = [myRecords stringByAppendingString:[NSString stringWithFormat:@"%@ ",arecord]];                
                    NSLog (@"%@",aRecord);   
                    }   
    

    As Peter Hosey points out in the comments, this will give you one string with all three records separated by a space. You probably want to populate an array with these records instead.

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

Sidebar

Related Questions

I have 3 columns in Oracle database having table mytable and i want records
Grid View Data Bind i have a database table with 4 columns having data
I'm working rearchitecting a reporting/data warehouse type database. We currently have a table that
I have a table having 2 columns EmployeeId (int) and EmployeeDetails(XMl type) EmployeeId EmployeeDetails
What I want is to have a table having a first column with every
I have a table in database that is having some fields one of which
I have a table that contains a column that is XML data type. I
I am using cakephp with php, I have table with field id having data
I have DB2 table having following structure CREATE TABLE DUMMY ( ID CHARACTER(10) NOT
I have one table having ID and other attributes. How can I get list

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.