erroneous javascript loop

Hello.
I am having problems with a loop. I was looking at an old code which uploads pics on a server, and then allows me to loop those pictures on a website. But, I can’t use that type of code exactly. So, I have modified it but I am still having problems with it.

(Btw, I posted code in the PHP section (but I have since updated the code and instead of posting a link here an it looking all messy over there, I will post fresh code here. fastsol helped me to realize the problem I was having was with the fact that I might need a loop, hence the updated code).

[php]

<?php echo '
'; //path to directory to scan. $directory = "images/"; //get all image files with a .jpg extension. $images = glob("" . $directory . "*.jpg"); $imgs = ''; // create array foreach($images as $image){ $imgs[] = "$image"; } //shuffle array shuffle($imgs); //select first 20 images in randomized array $imgs = array_slice($imgs, 0, 20); echo"
    "; for($i=0; $i<$imgs; $i++){ echo"
  • "; $final_path = ($imgs,$i,'pic_url'); $pic = "\"\""; echo $pic; echo "
  • "; } echo"
"; echo '
'; ?>
[/php]

I realize that this part is completely wrong (I assume other parts might be wrong as well. Concerning this piece, why I wrote pic_url I have no idea (I am thinking it is some type of code or a mysql column or something. Not my forte at all, not yet anyhow!)

$final_path = ($imgs,$i,'pic_url');

As for the rest of the coding, I am also unsure of it as it is merely modified code which I had code a year ago.

Sponsor our Newsletter | Privacy Policy | Terms of Service