Selecting Row in UITableView not working
I have a two UITableViews in one view, when i select a row in one tableview the text in that row is not printing and jus showing as NULL when i print it.

Pls find the code for your reference .


    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
        if(tableView == secondTable){
            UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
           name =[[NSString alloc]initWithString: cell.textLabel.text];
            NSLog(@"Name of row %@",name);
        }

    -(IBAction)resPage:(id)sender{
         sqlite3 *database;
        favorite=[[NSMutableArray alloc]init];
        if(sqlite3_open([databasePath UTF8String], &database)== SQLITE_OK){
             NSString *sql=[NSString stringWithFormat:@"SELECT * WHERE country.name ='%@'", name];
            const char *sqlStatement = [sql UTF8String];;
            sqlite3_stmt *compiledStatement;
            NSLog(@"a");
            if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL)==SQLITE_OK){
                NSLog(@"A");
                while (sqlite3_step(compiledStatement)==SQLITE_ROW) {
                      a= [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
                    db *info =[[db alloc]initWithText:(NSString *)d ];
                    [favorite addObject:info];
                }            
            }
            sqlite3_finalize(compiledStatement);
        
        sqlite3_close(database);
    
       
            
            if(favorite.count >0){
            txt.text = [NSString stringWithFormat:@"%@ ", [favorite objectAtIndex:0] ];
            
            }}
    }


The row selected is not printing..Kindly suggest

Selecting Row in UITableView not working
===

I have a two UITableViews in one view, when i select a row in one tableview the text in that row is not printing and jus showing as NULL when i print it.

Pls find the code for your reference .


    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
        if(tableView == secondTable){
            UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
           name =[[NSString alloc]initWithString: cell.textLabel.text];
            NSLog(@"Name of row %@",name);
        }

    -(IBAction)resPage:(id)sender{
         sqlite3 *database;
        favorite=[[NSMutableArray alloc]init];
        if(sqlite3_open([databasePath UTF8String], &database)== SQLITE_OK){
             NSString *sql=[NSString stringWithFormat:@"SELECT * WHERE country.name ='%@'", name];
            const char *sqlStatement = [sql UTF8String];;
            sqlite3_stmt *compiledStatement;
            NSLog(@"a");
            if(sqlite3_prepare_v2(database, sqlStatement, -1, &compiledStatement, NULL)==SQLITE_OK){
                NSLog(@"A");
                while (sqlite3_step(compiledStatement)==SQLITE_ROW) {
                      a= [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];
                    db *info =[[db alloc]initWithText:(NSString *)d ];
                    [favorite addObject:info];
                }            
            }
            sqlite3_finalize(compiledStatement);
        
        sqlite3_close(database);
    
       
            
            if(favorite.count >0){
            txt.text = [NSString stringWithFormat:@"%@ ", [favorite objectAtIndex:0] ];
            
            }}
    }


The row selected is not printing..Kindly suggest
