title: Can't display image from sqlite database (blob) in iphone
body: <p>I'm trying to display image from my sqlite database (as a blob), it knows that the image file is there by displaying the length of the image and the NSLog:"Image FOUND", but it doesn't load the image in the imageview. I've tried those many examples from stackoverflow like <a href="https://stackoverflow.com/questions/643682/reading-and-writing-images-to-an-sqlite-db-for-iphone-use/643819#643819">this one</a> and more else but still no issue.Thanks in advance guys. Here is what I got so far:</p>
  
  <pre><code>sqlite3_stmt *statement1;
  
  NSString *querySQL1 = [NSString stringWithFormat:@"SELECT picture FROM table1 WHERE var = %f", variable];
  
  const char *query_statement1 = [querySQL1 UTF8String];
  
  if(sqlite3_prepare_v2(_DB, query_statement1, -1, &amp;statement1, nil) == SQLITE_OK)
  {
  
      if (sqlite3_step(statement1) == SQLITE_ROW)
      {
  
      int length = sqlite3_column_bytes(statement1, 0);
  
      NSData *data = [[NSData alloc] initWithBytes:sqlite3_column_blob(statement1, 0) length:length];
  
          UIImage *image = [UIImage imageWithData:data];
  
          NSLog(@"Length : %d", [data length]);
  
          if(data == nil)
              {
                  NSLog(@"No image found.");
              }
  
          else
              {
                  NSLog(@"image FOUND .");
                  myImageView.image = image;       
              }   
      }
  
  }
  </code></pre>