Xcode中的PHP脚本非常奇怪的错误

时间:2013-03-19 08:32:24

标签: php xcode

我的xcode项目中有很多脚本,我从mysql数据库中获取东西......但是我遇到了这个非常奇怪的问题..在应用程序的第一页上,我无法获得输出从PHP脚本中没有在所有内容中间断行...

这是我的代码:

    <?php
    include("connect.php");

    $id = $_GET['id'];

    ?>

    <?

    $res = mysql_query("SELECT * FROM lande WHERE id = '$id'");
    while($row = mysql_fetch_array($res))
    {

     $navn = $row['name'];

     echo$navn;

    }

    ?>

没有任何意义..它适用于所有其他查询...

我找到了国家/地区的ID:

      NSString *strUrl2 = [NSString stringWithFormat:@"http://localhost:xxxx/xxxx/frontpage.php"];

      NSData *dataURL2 = [NSData dataWithContentsOfURL:[NSURL URLWithString:strUrl2]];

      NSString *strResult2 = [[NSString alloc] initWithData:dataURL2 encoding:NSUTF8StringEncoding];

然后通过$ _GET发送到下一页:

        NSString *strUrl1 = [NSString stringWithFormat:@"http://localhost:xxxx/xxxx/frontpage2.php?id=%@", strResult2];

        NSData *dataURL1 = [NSData dataWithContentsOfURL:[NSURL URLWithString:strUrl1]];

        NSString *strResult1 = [[NSString alloc] initWithData:dataURL1 encoding:NSUTF8StringEncoding];

        NSLog(@"%@", strResult1);

但是它要求我在首页脚本的中间进行换行:

     $id = $_GET['id'];

     ?>

     <?

     $res = mysql_query("SELECT * FROM lande WHERE id = '$id'");

否则它不输出它......

编辑:我试图通过$ _GET向frontpage.php发送另一个变量,它运行得很好! strResult1有什么问题?

欣赏各种帮助!

0 个答案:

没有答案