快速语法问题

时间:2017-05-30 03:07:47

标签: php string variables header

我收到此错误

  

解析错误:语法错误,意外'"',期待','或者')'在第7行的/storage/ssd2/202/1552202/public_html/randomreview.php中

我真的不知道它有什么问题。

这是我的代码:

<?php
 $db = new PDO('mysql:host=localhost;dbname=id1552202_accounts', 'id1552202_thecouch', 'Fargo123');
  $random = $db->prepare("SELECT path FROM Reviews ORDER BY RAND() LIMIT 1;");
      $random->execute();
 while($result = $random->fetch(PDO::FETCH_ASSOC)){ 
      $path = $result['path'];
      header('Location: https://thecouch.000webhostapp.com/'$path);
        }
?>

2 个答案:

答案 0 :(得分:3)

你忘了连接

public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
    Plugin.HtmlLabel.iOS.HtmlLabelRenderer.Initialize();
    global::Xamarin.Forms.Forms.Init();

    LoadApplication(new App());

    return base.FinishedLaunching(app, options);
}

----------------------------------------------- ----------------------------------------- ^ -------- -

答案 1 :(得分:0)

  

不需要;限制1后SELECT path FROM Reviews ORDER BY RAND() LIMIT 1;");中的(分号)。并在标题中查看您的标题。

<?php
 $db = new PDO('mysql:host=localhost;dbname=id1552202_accounts', 'id1552202_thecouch', 'Fargo123');
  $random = $db->prepare("SELECT path FROM Reviews ORDER BY RAND() LIMIT 1");
      $random->execute();
 while($result = $random->fetch(PDO::FETCH_ASSOC)){ 
      $path = $result['path'];
      header('Location: https://thecouch.000webhostapp.com/'.$path);
        }
?>