-2

I have a problem with syntax error. trying to upload image from directory into my list in html but it keeps saying things like:

Parse error: syntax error, unexpected '"', expecting ',' or ';' in D:\xampp\htdocs\Waldi\index.php on line 243

<?php

$dir="img/";


if($opendir=opendir($dir)){
  while(($file=readdir($opendir))!==FALSE){
    if($file!="." && $file!="..")
     echo '<li class="col-lg-4 col-md-4 col-sm-3 col-xs-4 col-xxs-12">
         <img class="img-responsive" src='"$dir/$file"'>
         </li>';
  }
}
?>
Milo111
  • 3
  • 2
  • 1
    http://php.net/manual/en/language.types.string.php – AbraCadaver Aug 25 '16 at 15:54
  • It's not a "complex" error. YOu just need to learn proper PHP string syntax, particularly the bits on how to embed the same quotes in a string you're using to DELIMIT the strings. – Marc B Aug 25 '16 at 15:55

1 Answers1

0

It's a quote question. Try This

$dir = "img/";


if ($opendir = opendir($dir) ) {
  while ( ($file = readdir($opendir) ) !== FALSE) {
    if ($file != "." && $file != "..") {
      echo '<li class="col-lg-4 col-md-4 col-sm-3 col-xs-4 col-xxs-12">
              <img class="img-responsive" src="'.$dir.'/'.$file.'">
            </li>';
    }
  }
}
anatoli
  • 336
  • 6
  • 14