RE: fopen() question
| From: | Mitja Slenc | Date: | Fri, 28 Feb 2003 22:06:05 +0000 |
| Subject: | RE: fopen() question | ||
| References: | 1 | Groups: | php.mirrors |
| Request: | Send a blank email to php-mirrors+get-15959@lists.php.net to get a copy of this message | ||
This is not the appropriate address for support questions. Please see
www.php.net/support
Mitja
-----Original Message-----
From: Scott Rider [mailto:srider01@jccc.net]
Sent: Friday, February 28, 2003 10:23 PM
To: 'webmaster@php.net'
Subject: fopen() question
I want to display all like named sequencial files without duplicating the
information manually and only produce code for the files present.
I think I have narrowed it down to two possiblities... fopen doesn't work
with strings inside a for loop or there is something about the string I am
producing that fopen balks on. What am I doing wrong?
If I eliminate the for loop and have $i=1 everything works fine.
Handcoding a single path and file into the fopen statement also works.
<html>
<body>
<?
$bcode = "<img src=\"";
$path = "http://www.angelfire.com/rpg/scottrider/backgrounds/";
$file = "bg";
$ext=".jpg";
$ecode= "\">\n";
for($i = 1; $i < 10; ++$i)
{
$tnumber = "".sprintf("%02d",$i)."";
$tfile = "".$path.$file.$tnumber.$ext."";
$nfile = @fopen("$tfile","r");
if($nfile)
{
print $bcode.$tfile.$ecode."<br>\n";
}
}
?>
</body>
</html>