"; $j++; } } closedir($dh); $time_to_mod=date('U'); $random=rand(0,count($filename)-1); $random_image=$filename[$random]; //echo $random_image; //echo $numberitems; $caption_query=mysql_query("select * from picture_captions where pic_path='$random_image'"); $caption=mysql_fetch_array($caption_query); echo "\"".htmlentities($caption['caption'])."\""; } } ?>