Hi Everyone:

I am assigning the value of 4 images to variables following a database query: 

$image_1 = stripslashes( $row['image_1'] );
$image_2 = stripslashes( $row['image_2'] );
$image_3 = stripslashes( $row['image_3'] );
$image_4 = stripslashes( $row['image_4'] );

What I need help with is how to represent the variable using $i for the number 
portion in the following WHILE loop.  I am not sure of how to correctly do it.  
I am referring to: $image_{$i}

===
$i = 1;
while ( $i <= 4 ) {

    if ( trim( $image_{$i} ) <> "" ) { 
    
        echo "<li><a href=\"http://www.theverseoftheday.info/store-images/"; . 
$image_{$i} . "\" title=\"Image " . $i . "\">Image " . $i . "</a></li>\r\n";
                        
    }

++$i;
}
===

How do I substitute $i for the # so I may use a WHILE loop to display the 
images?  (Not all 4 variables have an image.)

Ron Piggott



www.TheVerseOfTheDay.info 

Reply via email to