การแสดงรูปในเวปอีกครั้งครับ

เริ่มโดย manoo, 23 กรกฎาคม 2009, 19:26:18

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

manoo

เขียน โค้ตตามนี้แต่มันขึ้น
Warning: opendir(./image/activity/$id" . "/1.gif): failed to open dir: Invalid argument in c:\appserv\www\allsell\sh_activity.php on line 37


ส่วนนี้script ครับ

<?php            
$column = 3;
$photoDir = './image/activity/$id" . "/1.gif';
$thumbDir = './thumb/' ;
$dir = opendir($photoDir);
echo "<Table width=80% border=1 cellspacing=0 cellpadding=5 bordercolordark=white> \n";
$ic = 1;
While($file = readdir( $dir )) {
   if (eregi(".jpg$",$file) OR eregi(".gif$",$file) OR eregi(".png$",$file)) {
      if ($ic  == 1) { 
         echo "<tr align=center>"; 
      }
   $size= round(filesize($photoDir . $file) /1024 , 1) ;
      echo "<td><a href='$photoDir$file' target=_blank><img src='$thumbDir$file' border=0></a><br>$file ($size KB)</td>";
      $ic++;

      if ($ic  > $column ) { 
         echo "</tr> \n";
         $ic = 1;
      }
   }
}   
echo '</Table>';
closedir( $dir );
?>


ohmohm

ลองใส่ @ หน้า opendir
http://th2.php.net/function.opendir

บรรรทัดที่สอง
'./image/activity/$id" . "/1.gif'
ดูแปลกๆ ทั้ง single และ double quot
อีกอย่าง $id ซึ่งอยู่ใน single quot มันจะไม่ถูกเอาค่าของตัวแปร $id มาใช้

manoo