こんにちは、mysql データベースにデータを挿入しようとしています。保存をクリックするたびに新しいコンテンツを取得しますが、データベースの列はテキストを取得しません(テキストビューとテキストフィールドから)。
-(IBAction)save:(id)sender{
NSString *rawStr = [NSString stringWithFormat:@"location=%@",address.text,@"&long=%@",longitude.text,@"&lat=%@",lat.text,@"&texten=%@",texten.text];
NSData *data = [rawStr dataUsingEncoding:NSUTF8StringEncoding];
NSURL *url = [NSURL URLWithString:@"http://url.info/projct/phpFile.php"];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPMethod:@"POST"];
[request setHTTPBody:data];
NSURLResponse *response;
NSError *err;
NSData *responseData = [NSURLConnection sendSynchronousRequest:request returningResponse:&response error:&err];
NSLog(@"responseData: %@", responseData);
[self dismissViewControllerAnimated:YES completion:nil];
}
Webブラウザでデータベースにデータを挿入すると機能します。