title: populating db records in a common NIB(Because same UI but different data from sqlite ) depending upon button clickd
body: <p>i have followed <a href="http://dblog.com.au/iphone-development-tutorials/iphone-sdk-tutorial-reading-data-from-a-sqlite-database/" rel="nofollow">this tutorial</a> 
  i am working on a simple game project.I am having a view consisting of uibutton.for eg,
  Movies Button, Places Button and Personalities Button.
  Now on clicking on Movies button a new NIB opens.Similarly for clicking on Places and for Personalities buttons the same NIB opens.</p>
  
  <p><strong>Note:NIB is same for all three buttons Movies,Places and Personalities,but data to be populated on that NIB is different.</strong></p>
  
  <p>i have done some stuff regarding connecting to database through resources and adding framework.Holding info(for Movies,Places and Personalities) in corresponding arrays in appdelegate.
  I have used NSObject class(Questions.h and .m) having id and name for question Movies,Places and Personalities.I had initialize them.</p>
  
  <p><strong>Problem</strong>:i want to open a single nib class/file having different instance(same UI but diffenet data depending on type of button pressed Movies,Places and Personalities).Some of the code snippts for my approach:</p>
  
  <h3>my appdelegate.h</h3>
  
  <pre><code>    UIWindow *window;
      UINavigationController *navigationController;
  
      NSString *databaseName;
      NSString *databasePath;
      sqlite3 *database;
  
      // Array to store the Movies objects
      NSMutableArray *movies;
      // Array to store the places objects
      NSMutableArray *places;
      // Array to store the personalities objects
      NSMutableArray *personalities; }  
  @property (nonatomic, retain) IBOutlet UIWindow *window;  
  @property (nonatomic, retain) IBOutlet UINavigationController *navigationController;  
  @property (nonatomic, retain) NSMutableArray *movies;  
  @property (nonatomic, retain) NSMutableArray *places;  
  @property (nonatomic, retain) NSMutableArray *personalities;  
  </code></pre>
  
  <h3>My appdelegate.m</h3>
  
  <pre><code>-(void) readMoviesFromDatabase   
  {   
          const char *sqlStatement = "select * from tblMovies";  
          sqlite3_stmt *compiledStatement;  
          if(sqlite3_prepare_v2(database, sqlStatement, -1, &amp;compiledStatement, NULL) == SQLITE_OK)   
          {
              while(sqlite3_step(compiledStatement) == SQLITE_ROW)   
              {                               
                  NSString *amovieName = [NSString stringWithUTF8String:(char *)sqlite3_column_text(compiledStatement, 1)];  
                  NSInteger amovieId = sqlite3_column_int(compiledStatement, 2);              
                  Questions *questions = [[Questions alloc] initWithmovieName:amovieName movieId:amovieId];               
                  [movies addObject:questions];  
                  [questions release];  
              }  
          sqlite3_finalize(compiledStatement);  
          }
          [self closeDataBase];  
  } 
  </code></pre>
  
  <p>Similarly for:
  <code>-(void) readPlacesFromDatabase and (void) readPersonalitiesFromDatabase</code>  </p>
  
  <h3>My Question.m file:</h3>
  
  <pre><code>-(id)initWithmovieName:(NSString *)mN movieId:(NSInteger)mId
  {
      self.movieName=mN;
      self.movieId=mId;
      return self;
  }    
  **similarly for PlaceName and PersonalityName.**
  </code></pre>
  
  <h3>My GameCategory.m</h3>
  
  <pre><code>**//I am stuffing here what do here so that on clicking any of the button the same NIB //opens but with different data.**  
  -(IBAction) moviesButtonPressed:(id)sender   
  {  
      TheCommonNib *theCommonNib = [[TheCommonNib alloc] initWithNibName:@"TheCommonNib" bundle:nil];  
      [self.navigationController pushViewController:theCommonNib animated:YES];  
      [theCommonNib release];  
  }  
  -(IBAction) placesButtonPressed:(id)sender   
  {  
      TheCommonNib *theCommonNib = [[TheCommonNib alloc] initWithNibName:@"TheCommonNib" bundle:nil];  
      [self.navigationController pushViewController:theCommonNib animated:YES];  
      [theCommonNib release];  
  }
  </code></pre>
  
  <p>Please help or guide me.</p>