-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
  • 24,667
  • 25
  • 136
  • 263

2 Answers2

3

You forgot to concatenate

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

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

sumit
  • 14,108
  • 10
  • 62
  • 106
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,356
  • 1
  • 23
  • 33
  • ("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