[Solved] Data not updating in sqlite database in iphone [closed]


This line causes the issue.

NSString *querystr = [NSString stringWithFormat:@"Update Quest set solved = '%d' where q_id = '%d'",solved,q_id+1 ];

The fields solved and q_id are of type integer. You are checking it with string, that makes the issue.

Change the query string to:

NSString *querystr = [NSString stringWithFormat:@"Update Quest set solved = %d where q_id = %d",solved,q_id+1 ];

Also change the prepare condition like:

if(sqlite3_prepare_v2(data , [querystr UTF8String], -1, &sqlStatement, NULL) == SQLITE_OK)
{
   sqlite3_step(sqlStatement);
   NSLog(@"query executed");
}

9

solved Data not updating in sqlite database in iphone [closed]