将id从iOS应用程序发送到php再发送到mysql


send id from iOS app to php to mysql

我正在制作一个用于在iphone中存储商店的应用程序,但我有一个简单的问题。当我调用xcode中的delete函数我尝试使用以下代码,但它仍然向我的php文件发送null。我想发送(filename.php?id=1),但我得到了filename.php吗?id=(空)

问题出在哪里?

butikID中的数字是我想发送到我的php 的数字

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (editingStyle == UITableViewCellEditingStyleDelete)
    {
        //Remove from our NSMutablearray
        NSMutableString *postString = [NSMutableString stringWithString:kPostURLdelete];
        [postString appendString:[NSString stringWithFormat:@"?%@=%@", kID, butikID]];

        //[postString appendString:[NSString stringWithFormat:@"&%@=%@", kName, butiksnamn]];
        [postString setString:[postString stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]];
        NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:[NSURL URLWithString:postString]];
        [request setHTTPMethod:@"GET"];
        postConnection = [[NSURLConnection alloc] initWithRequest:request delegate:self startImmediately:YES];
        NSLog(butikID);
        [butiksArray removeObjectAtIndex:indexPath.row];
        // Delete it from the tableview
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath]withRowAnimation:UITableViewRowAnimationFade];
    }
}

如果butikID是NSNumber:

[postString appendString:[NSString stringWithFormat:@"?%@=%i", kID, [butikID intValue]]];

如果是int:

[postString appendString:[NSString stringWithFormat:@"?%@=%i", kID, butikID]];