我受尽折磨。我不明白为什么这段代码不起作用?我做错什么了?谢谢,我真的需要帮助
<?php
$name = $POST['name'];
$tel = $POST['tel'];
$dbhost = "sql200.60ru.com";
$dbuser = "****";
$dbpassword = "***";
$dbname = "60ru_11939825_zav333";
$link = mysql_connect($dbhost, $dbuser, $dbpassword);
mysql_select_db($dbname, $link);
$query = "INSERT INTO customer (name, tel) VALUES (" . $name . "," . $tel . ")";
mysql_query($query, $link);
mysql_close($link);
?>
和
NSString *bodyData = @"fio=GGG&telefon=2521521551277777";
NSMutableURLRequest *postRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"http://zav333.60ru.com/test/insert.php"]];
[postRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[postRequest setHTTPMethod:@"POST"];
[postRequest setHTTPBody:[NSData dataWithBytes:[bodyData UTF8String] length:[bodyData length]]];
self.mainUrl = [[NSURLConnection alloc] initWithRequest:postRequest delegate:self];