Jump to content

Array Help Please


cristobal

Recommended Posts

am a newbie to PHP for sure. I need some advice though. I am attempting to tweak an existing PHP script I have.

 

The is an array called $row that has all the value that was pulled from a database.

 

I want to take the values $row [ 'propertyphoto1' ] , $row [ 'propertyphoto2' ], $row [ 'propertyphoto3' ] and so forth up to propertyphoto 8 and put them in a different array in which I will use that array to mesh with a image rotator.

 

Here is the code I am working with:

?php if ( ! $row [ 'propertyphoto1' ] )

{

?><img src="<?php echo $ImageURL; ?>nopropertyimage.jpg" border="0" align="left" hspace="10" height="150" width="200"><?php

}

else

{

?><?

$pic = array("echo $row ['propertyphoto2']", "echo $row ['propertyphoto3']", "echo $row ['propertyphoto1']" );

 

?>

<? echo $pic[2]; ?>

 

I have the above echo $pic[2]; just to see if I am actually storing the array correctly ie., the propertyphoto values.

 

But all it does it print out

 

echo Array ['propertyphoto1']

 

instead the actual value of the propertyphoto1 which is something like imagename.jpg.

 

Can anyone point me to the right direction as to what I am doing wrong??

 

Thanks for your help

 

Chris

Link to comment
https://forums.phpfreaks.com/topic/123708-array-help-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.