Soldato
- Joined
- 31 Oct 2005
- Posts
- 8,846
- Location
- Leeds
After taking advice from IIRC DJ Jestar about using the glob function I have ended up with this
Now the above works when I use
as there is a file called 7.JPG
However I'm trying to use the variable $d_no, which when echoed on that page displays fine, however if I used the first piece of php code, globing the variable $d_no, I'm met with
"Warning: Invalid argument supplied for foreach() in /home/irgscouk/public_html/userpage.php on line 61"
I'm sure it's just the way I'm declaring my variable
Any ideas?
PHP:
<?php
foreach glob("'$d_no'.JPG") as $file) {
echo '<td>' . "<a href='$file' target=_blank><img src='$file' alt='$file' width='220' height='220'></a>" . '</td>';
}
echo '</table>';
?>
Now the above works when I use
PHP:
(glob("'7.JPG") as $file) {
However I'm trying to use the variable $d_no, which when echoed on that page displays fine, however if I used the first piece of php code, globing the variable $d_no, I'm met with
"Warning: Invalid argument supplied for foreach() in /home/irgscouk/public_html/userpage.php on line 61"
I'm sure it's just the way I'm declaring my variable
Any ideas?