-1

I get this error

Parse error: syntax error, unexpected '"', expecting ',' or ')' in /storage/ssd2/202/1552202/public_html/randomreview.php on line 7

I don't really know what's wrong with it.

Here's my code:

<?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);
        }
?>
LF00
  • 27,015
  • 29
  • 156
  • 295

2 Answers2

3

You forgot to concatenate

header('Location: https://thecouch.000webhostapp.com/'.$path);

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

sumit
  • 15,003
  • 12
  • 69
  • 110
0

don't need ; ( semicolon) in SELECT path FROM Reviews ORDER BY RAND() LIMIT 1;"); after limit 1 . And check your concate in header .

<?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);
        }
?>
RïshïKêsh Kümar
  • 4,734
  • 1
  • 24
  • 36
  • ("SELECT path FROM Reviews ORDER BY RAND() LIMIT 1;"); .... Check this.. and also your concate variable with string in 7 line... ( header ) Line. – RïshïKêsh Kümar May 30 '17 at 03:37