Jump to content


Photo

[SOLVED] whats wrong with this?


  • Please log in to reply
2 replies to this topic

#1 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 26 April 2006 - 06:02 PM

it was working fine displaying my pictures, but out of no where it stared only displaying the first picture in the directory if any one one please help me.. as quick as you can..

<table border="1">
<?
$path = "/Gallery/thumbs/";
$handle = opendir($path);
$row = 3;
$col = 3;

while(false !==($file = readdir($handle))){
if($file !="." && $file !=".."){

     for($r=1;$r <= $row; $r++){
     echo "<tr>";
 for($c=1; $c <= $col; $c++){
 echo "<td><img src=$path/$file></td>";
 }
 echo "</tr>";
}
closedir($handle);
}

}

?>
</table>


#2 ToonMariner

ToonMariner
  • Members
  • PipPipPip
  • Advanced Member
  • 3,342 posts
  • LocationNewcastle upon Tyne, UK

Posted 26 April 2006 - 06:11 PM

how many files are in the directory?

You loop through rows and columsn INSIDE the file loop - so you will probably get 9 of the first file and then 9 of the second and so on


do the row and column loop outside and have some continue in there to move on to the next file.
follow me on twitter @PHPsycho

#3 corillo181

corillo181
  • Members
  • PipPipPip
  • Advanced Member
  • 896 posts

Posted 26 April 2006 - 06:43 PM

[!--quoteo(post=368929:date=Apr 26 2006, 02:11 PM:name=ToonMariner)--][div class=\'quotetop\']QUOTE(ToonMariner @ Apr 26 2006, 02:11 PM) View Post[/div][div class=\'quotemain\'][!--quotec--]
how many files are in the directory?

You loop through rows and columsn INSIDE the file loop - so you will probably get 9 of the first file and then 9 of the second and so on
do the row and column loop outside and have some continue in there to move on to the next file.
[/quote]



i got a lot of pictures in there..
oh i see i seen that contenie but i dont remeber how to use it, it bypassed my becuase i'm staring little by little.. so every little thing turns in to a big problem for me..




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users