FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » displaying image
Show: Today's Messages :: Unread Messages :: Show Polls :: Message Navigator
| Subscribe to topic | Bookmark topic 
Switch to threaded view of this topic Create a new topic Submit Reply
displaying image [message #181279] Wed, 01 May 2013 12:31 Go to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
http://mroldies.net/showtable.php?year=1960
Click on first link only.

I am using a 2d array and want to display an image based upon the number
key of that array.

<?php echo "<img src='$list[1]['cover']'>"; ?>

This line gives a place holder in firefox and in IE.
It should at least show this image.
http://mroldies.net/covers/1960-001.jpg
Re: displaying image [message #181280 is a reply to message #181279] Wed, 01 May 2013 13:33 Go to previous messageGo to next message
richard is currently offline  richard   
Messages: 213
Registered: June 2013
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On Wed, 1 May 2013 12:31:58 -0400, richard wrote:

> http://mroldies.net/showtable.php?year=1960
> Click on first link only.
>
> I am using a 2d array and want to display an image based upon the number
> key of that array.
>
> <?php echo "<img src='$list[1]['cover']'>"; ?>
>
> This line gives a place holder in firefox and in IE.
> It should at least show this image.
> http://mroldies.net/covers/1960-001.jpg

fixed!
put the entire tag into the array.
then echo the array.
Re: displaying image [message #181282 is a reply to message #181279] Wed, 01 May 2013 15:19 Go to previous message
Scott Johnson is currently offline  Scott Johnson
Messages: 196
Registered: January 2012
Karma: 0
Senior Member
add to buddy list
ignore all messages by this user
On 5/1/2013 9:31 AM, richard wrote:
> http://mroldies.net/showtable.php?year=1960
> Click on first link only.
>
> I am using a 2d array and want to display an image based upon the number
> key of that array.
>
> <?php echo "<img src='$list[1]['cover']'>"; ?>
>
> This line gives a place holder in firefox and in IE.
> It should at least show this image.
> http://mroldies.net/covers/1960-001.jpg
>

I think the problem you are having is you are using a 'complex' var in a
simple parse method (double quotes).

Once the engine hit the first closing array index bracket ']', the var
is done being parsed.

Try concatenate with '.'

<?php echo "<img src='" . $list[1]['cover'] . "'>"; ?>

or my favorite, use the complex type parsing with curlies.

<?php echo "<img src='{$list[1]['cover']}'>"; ?>

Scotty
Quick Reply
Formatting Tools:   
  Switch to threaded view of this topic Create a new topic
Previous Topic: Got a chuckle and wanted to share.
Next Topic: SoapServer constructor parameters: what is actor uri?
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sun Dec 17 08:43:54 EST 2017

Total time taken to generate the page: 0.00706 seconds