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

From: Date: Tue, 27 Mar 2001 19:09:26 +0000
Subject: RE: [PHP-DB] A question - ($file_exists)
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-7905@lists.php.net to get a copy of this message
oops $x should start with "0" -----Original Message----- From: Larry Rivera [mailto:web@ldstudio.net] Sent: Tuesday, March 27, 2001 11:04 AM To: webmaster@charmed-ones.com; php-db@lists.php.net Subject: RE: [PHP-DB] A question - ($file_exists) or you can put yuou r values into an array then for(loop) thru the thing checking as you go. Example ====>>>> $img[] = "episodeID_a.jpg"; $img[] = "episodeID_b.jpg"; $img[] = "episodeID_c.jpg"; for ($x=0; $x <count($img); $x++) { if (!$file_exists(.//$img[$x])) { //Change the variable $img? and give it the value of a temporary, blank image echo "blank.jpg"; // more code }else{ echo $img[$x]; // more code }//end if }//end for loop -----Original Message----- From: rjm2@anglia.ac.uk [mailto:rjm2@anglia.ac.uk]On Behalf Of Russ Michell Sent: Tuesday, March 27, 2001 10:46 AM To: webmaster@charmed-ones.com Cc: php-db@lists.php.net Subject: Re: [PHP-DB] A question - ($file_exists) Hi there: What about doing it like this: <?php $num = mysql_num_rows($result); while($row = mysql_fetch_array($result)) { $image = $row['image']; } //Loop through all images in DB: for($count = 0; $count < count($image); $count++) { $display_this = $display_this . $image; } //end for-loop } //end-while loop if($num != 0) { //Images exist so display them: echo $display_this; } else { //Images don't exist so display blank inage: echo "path/to/blank.gif;" } ?> #-------------------------------------------------------# "Believe nothing - consider everything" Russ Michell Anglia Polytechnic University Webteam http://gertrude.sipu.anglia.ac.uk/webteam r.j.michell@anglia.ac.uk +44 (0)1223 363271 ext 2331 www.theruss.com #-------------------------------------------------------# -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net For additional commands, e-mail: php-db-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net

« previous php.db (#7905) next »