I want to check if the user has entered correct username and password or not. i have created the database with many username and passwords. Thanks in advance.
-(IBAction)LoginPressed:(id)sender{
arrayofusername = [[NSMutableArray alloc] init];
FMDatabase *database = [FMDatabase databaseWithPath:[self GetDBPath]];
[database open];
FMResultSet *results =[database executeQuery:@"SELECT * FROM RecordTable"];
NSString *queryforchecking = [NSString stringWithFormat:@"SELECT * FROM RecordTable where username = '%@' and password = '%@'",L_usernameField.text,L_passwordField.text];
results = [database executeQuery:queryforchecking];
while ([results next]) {
username = [results stringForColumn:@"username"];
if ([username isEqualToString:queryforchecking]) {
NSLog(@"matched");
}
else{
NSLog(@"not matched");
}
}
}