连接到数据库只发送一个字iOS

I want to send some string text data from my iphone to the server. I am using a php file on my server. The php works fine if i use it on the webpage but only sends one word if there are 2 words nothing will be send like the connection does not exist.

PHP:

if (isset ($_GET["vic"]))
        $name = $_GET["vic"];
    else
        $name = "empty text";


$con = mysql_connect('sqlserver', 'username', 'pasword'); 
if (!$con) { 
    die('Could not connect: ' . mysql_error()); 
} 
echo 'Connected successfully'; 
mysql_select_db(db_name); 

$sql = "insert into Vici (VIC) values('$name');";
    $res = mysql_query($sql,$con) or die(mysql_error());

mysql_close($con);


?> 

iOS:

- (IBAction)add
{

    NSString *vic = txtVic.text;

    NSString *strURL = [NSString stringWithFormat:@"%@%@",@"http://URL",vic];

    NSData *dataURL = [NSData dataWithContentsOfURL:[NSURL URLWithString:strURL]];

    NSString *strResult = [[NSString alloc] initWithData:dataURL encoding:NSUTF8StringEncoding];


    NSString *povezava = @"Connected successfully ";
    if([povezava isEqualToString:strResult])
        izpis.text = @"added";

}

I did not use any real info because its private. Than you.

You should replace NSString *vic = txtVic.text; with NSString *vic = [txtVic.text stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; as @DineshRaja commented.

NSString *strURL = [NSString stringWithFormat:@"%@%@",@"http://URL",vic];

This string will give You

http://URLvic

If I understand correctly Your link should looks like http://URL/?vic=%@

NSString *strURL = [NSString stringWithFormat:@"%@/?vic=%@",@"http://URL",vic];