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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:13:00+00:00 2026-05-27T14:13:00+00:00

i have two entries in my database sqlite> select *from courses; 1|ME|273|Statics|MWF|02:20 pm-03:20 pm|James

  • 0

i have two entries in my database

sqlite> select *from courses;
1|ME|273|Statics|MWF|02:20 pm-03:20 pm|James M. Pitarresi|LH 002
2|CS|328|Internet|TR|02:20 pm-03:20 pm|Steflik|eb 23

and i have following code but it does only show first entry in my database

   -(NSMutableArray *) getCourses
    {
         courses = [[NSMutableArray alloc] init];
         FMDatabase *db = [FMDatabase databaseWithPath:[Utility getDatabasePath]];
        [db open];  
        FMResultSet *results = [db executeQuery:@"SELECT * FROM courses"];

        if ([db hadError]) {
            NSLog(@"DB Error %d: %@", [db lastErrorCode], [db lastErrorMessage]);
        }

        while([results next]) 
        {
            [courses addObject:[results stringForColumn:@"Subject"]];
            [courses addObject:[results stringForColumn:@"Course_Number"]];                
            [courses addObject:[results stringForColumn:@"Course_Title"]];                
            [courses addObject:[results stringForColumn:@"Days"]];               
            [courses addObject:[results stringForColumn:@"Time"]];            
            [courses addObject:[results stringForColumn:@"Instructor"]];                
            [courses addObject:[results stringForColumn:@"Location"]];  

        }

        NSLog(@"loop %@ ",courses);

        [results close];
        [db close];

        return courses; 

    }

my output is, it doesnt show second entry

loop (
    ME,
    273,
    Statics,
    MWF,
    "02:20 pm-03:20 pm",
    "James M. Pitarresi",
    "LH 002"
)

any ideas why this happens?

  • 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-27T14:13:00+00:00Added an answer on May 27, 2026 at 2:13 pm

    i dont know why but when i change the database name or create a new database problem solved

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

Sidebar

Related Questions

I have NSTableView with two columns, and i wanna fill them entries from SQLite
When you hit a roof on reading from a database, you have two choices,
I have two tables in a MySQL database, courses and sessions. I'm trying to
I have two instances of the same database. The first db represents data from
I'm having a problem with summing floats properly from my SQLite database. I have
I have a database with thousands of entries, that have two date/time fields, let's
I have two entries in my database Obj1 is tagged with hello, world, planet
Suppose I have ten cron jobs running in parallel which fetch entries from database
I have a database that contains two tables: entries tags The entries table contains
I have two questions. Do realloc() and memcpy() copy the entries in an array

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.