[Solved] How to change the image on click from database


From your question I understand that you need to change the image on each button click. If I’m correct then change the changenext method like:

-(IBAction)changenext
  {
    static int j = 0;
    if (j > 10)
    {
       j = 0;
    }
    [self Readthesqlitefile:j];
    j++;
  }

The above method will change the image on each button click. After displaying the last image it again starts from first image.

EDIT:

Also this line seems to be wrong

const char *chstmt="SELECT * FROM animal where rowid= = %d",sno; .

There is no == operator in sqlite3 (I’m think so).
Replace that line by,

NSString *query    = [NSString stringWithFormat:@"SELECT * FROM animal where rowid = %d",sno];
const char *chstmt = [query UTF8String];

2

solved How to change the image on click from database