[PHP-DB] A question - ($file_exists)

2001-03-27 Thread Matthew Cothier

I am setting up an episode guide for one of my favourite shows and with this 
I need to include three screenshots:

episodeID_a.jpg
episodeID_b.jpg
episodeID_c.jpg

In some cases though the files will not exist and therefore I need too check 
if they exist and if they don't then it will display a blank image...

Whats wrong with this code?

-

?php

$img1 = "episodeID_a.jpg";
$img2 = "episodeID_b.jpg";
$img3 = "episodeID_c.jpg";

for ($x=1; $x = 3; $x++) {

if (!$file_exists(.//$img$x)) {

//Change the variable $img? and give it the value of a temporary, blank 
image

$img$x="blank.jpg";

}

print("$img$xbr");

}

?



I would be grateful for any help with this, thanks in advance,

Matt
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] A question - ($file_exists)

2001-03-27 Thread Darryl Friesen

 Whats wrong with this code?

 $img1 = "episodeID_a.jpg";
 $img2 = "episodeID_b.jpg";
 $img3 = "episodeID_c.jpg";

 $img$x="blank.jpg";

That doesn't what you expect.  I think the syntax is the same as Perl:

$var  = "$img$x"; #  $var hold the _name_ of the variable
  #  you want to change
$$var = "blank.jpg";  #  The $$ syntax is used to references the
  #  actual variable

See the section of the manual dealing with variables
(http://www.php.net/manual/en/language.variables.php)


- Darryl

 --
  Darryl Friesen, B.Sc., Programmer/Analyst[EMAIL PROTECTED]
  Education  Research Technology Services, http://gollum.usask.ca/
  Department of Computing Services,
  University of Saskatchewan
 --
  "Go not to the Elves for counsel, for they will say both no and yes"



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP-DB] A question - ($file_exists)

2001-03-27 Thread Matthew Cothier

Why isn't this working?




?php

$img[] = "$episodeID_a.jpg";
$img[] = "$episodeID_b.jpg";
$img[] = "$episodeID_c.jpg";

for ($x=0; $xcount($img); $x++) {

if(!file_exists($img[$x])) {

print("td align=centerimg src=\"blank.gif\" width=160 height=120 
border=\"1\"/td");

} else {

print("td align=centerimg src=\"$img[$x]\" width=160 height=120 
border=\"1\"/td");

}//end if

}//end for loop
?
_
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]