我想在我的數據庫中存儲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