我想在我的数据库中存储4个值。经度,纬度电话号码和时间戳。插入数据到mysql - ios
我明白了人想出如何将它们与本地的存储的NSLog,
但我想将它发送到我的MySQL数据库。
有人有一些教程或想帮助我吗?
我需要这个不好,
您的帮助,将不胜感激。
电贺
UPDATE
下面是一些代码,我需要在我的数据库
resultsLabel.text = [NSString stringWithFormat:@"(%@) %@ Location %.06f %.06f %@", ([UIApplication sharedApplication].applicationState == UIApplicationStateBackground) ? @"bg" : @"fg", resultsLabel.tag == 0 ? @"gps:" : @"sig" , newLocation.coordinate.latitude, newLocation.coordinate.longitude, [formatter stringFromDate:newLocation.timestamp]];
LocationTestAppDelegate * appDelegate = (LocationTestAppDelegate *)[UIApplication sharedApplication].delegate;
[appDelegate log:resultsLabel.text];
NSString* encodedValue = [newLocation.coordinate.latitude
stringByAddingPercentEscapesUsingEncoding:
NSASCIIStringEncoding];
//construct an URL for your script, containing the encoded text for parameter value
NSURL* url = [NSURL urlWithString:
[NSString stringWithFormat:
@"http://yourdomain.com/locatie.php?id=%@",
encodedValue]];
NSError* error = nil;
//send the request synchronously, store the response in result
NSString* result = [NSString stringWithContentsOfURL:url
encoding:NSUTF8StringEncoding
error:&error];
if (!error && ([result isEqualToString:@"OK"])) {
// everything went well
}
存储,我需要从一个文本框,经度,纬度&时间戳存储的电话号码。
迎接(再次)
http://whathaveyoutried.com? – Luke
我试图做SQLite,但直到现在,这是行不通的。 –
如果你发布代码,那么人们更有可能协助修复它并帮助你。 ;) – Luke