我的 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 有什么问题?
感谢各种帮助!