Hi,
I'm trying to display an unset number of images on a page, using an array to hold things like the directory and filenames etc. However, instead of echoing the values of each image, the single letter in the $key position is being echoed.
For example "uploads" 2 gives the letter L.
I've had this working on a separate page, but the code looks exactly the same. Can anyone point me in the right direction? Thanks.
The following code
gives this...
I'm trying to display an unset number of images on a page, using an array to hold things like the directory and filenames etc. However, instead of echoing the values of each image, the single letter in the $key position is being echoed.
For example "uploads" 2 gives the letter L.
I've had this working on a separate page, but the code looks exactly the same. Can anyone point me in the right direction? Thanks.
Code:
$directories = array();
$filenames = array();
$locations = array();
if($imageConn->num_rows()>0){
while($imageConn->moveNext()) {
$directories[] = $imageConn->getField("directory");
$filenames[] = $imageConn->getField("filename");
$locations[] = $imageConn->getField("location");
}
}
foreach ($directories as $key => $directory) {
echo $directory[$key]."<br />";
echo $filename[$key]."<br />";
echo $location[$key]."<br />";
}
The following code
Code:
echo '<pre>';
print_r($directories);
echo '</pre>';
gives this...
Code:
Array
(
[0] => uploads/
[1] => uploads/
)