you can safely query a mysql database, directly from objective-c.
you must create a php code like this:
and this is the part of objective-c:
- (void)viewDidLoad {
NSString *stringName = @"Name";
NSString *stringType = @"Type";
NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString:@"http://yourURL.php?"]];
NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[receivedData appendData:data];
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
if (receivedData) {
id jsonObjects = [NSJSONSerialization JSONObjectWithData:receivedData options:NSJSONReadingMutableContainers error:nil];
for (NSDictionary *dataDict in jsonObjects) {
NSString *stringNameID = [dataDict objectForKey:@"Name"];
NSString *stringTypeID = [dataDict objectForKey:@"Type"];
dict = [NSDictionary dictionaryWithObjectsAndKeys:stringNameID, stringName, stringTypeID, stringType, nil];
[yourNSMutableArray addObject:dict];
}
[self.tableView reloadData];
}
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary *tmpDict = [yourNSMutableArray objectAtIndex:indexPath.row];
cell.textLabel.text = [tmpDict objectForKey:stringName];
cell.detailTextLabel.text = [tmpDict objectForKey:stringType];
}
and that's it, I hope can I help