title: FMDB Result set contains null iphone
body: <p>I am using FMDB for my application to store data in sqlite. Here is my code</p>
  
  <p>from AppDelegate</p>
  
  <pre><code>- (void)applicationDidFinishLaunching:(UIApplication *)application 
  </code></pre>
  
  <p>{</p>
  
  <p>FMDatabase* db = [FMDatabase databaseWithPath:@"/tmp/sql.sqlite"];</p>
  
  <pre><code>if (![db open]) {
      NSLog(@"Could not open db.");
  
  }
  NSLog(@"DB opened successfully");
  </code></pre>
  
  <p>// full code not shown here</p>
  
  <p>}</p>
  
  <p>I have following code in  ViewController</p>
  
  <pre><code>-(IBAction)insertButtonClicked:(id)sender
  </code></pre>
  
  <p>{
      NSLog(@"in insertButtonCLicked");</p>
  
  <pre><code>[db beginTransaction];
  
  [db executeUpdate:@"insert into sample (url) values (?)",@"google'"];
  
  [db commit];
  </code></pre>
  
  <p>}</p>
  
  <p>-(IBAction)displayButtonClicked:(id)sender</p>
  
  <p>{</p>
  
  <pre><code>NSLog(@"in DisplayCLicked");
  
  FMResultSet *rs = [db executeQuery:@"select url from sample"];
  
  NSLog(@"Rs contains =&gt; %@",rs);
  
  while( [rs next])
  {
  
      NSLog(@"%@",[rs stringForColumn:@"url"]);
  }
  [rs close];
  </code></pre>
  
  <p>}</p>
  
  <p>When i run this code i get rs as null as shown in following (this is o/p from console)</p>
  
  <pre><code>2011-03-07 07:30:06.919 InsertDataSample[3092:20b] DB opened successfully
  </code></pre>
  
  <p>2011-03-07 07:30:13.341 InsertDataSample[3092:20b] in insertButtonCLicked</p>
  
  <p>2011-03-07 07:30:16.860 InsertDataSample[3092:20b] in DisplayCLicked</p>
  
  <p>2011-03-07 07:30:16.860 InsertDataSample[3092:20b] Rs contains => (null)</p>
  
  <p>Plz help me friends. I am working on FMDB from many days but i am unable to use FMDB .
  Thanks in advance</p>