Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.php > #9224 > unrolled thread

displaying image

Started byrichard <noreply@example.com>
First post2013-05-01 12:31 -0400
Last post2013-05-01 12:19 -0700
Articles 3 — 2 participants

Back to article view | Back to comp.lang.php


Contents

  displaying image richard <noreply@example.com> - 2013-05-01 12:31 -0400
    Re: displaying image richard <noreply@example.com> - 2013-05-01 13:33 -0400
    Re: displaying image Scott Johnson <noonehome@chalupasworld.com> - 2013-05-01 12:19 -0700

#9224 — displaying image

Fromrichard <noreply@example.com>
Date2013-05-01 12:31 -0400
Subjectdisplaying image
Message-ID<1pm1j02t34la0.1g8tpja3pzb0q$.dlg@40tude.net>
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

[toc] | [next] | [standalone]


#9225

Fromrichard <noreply@example.com>
Date2013-05-01 13:33 -0400
Message-ID<ws0mqlzwkdwe.1dvtgzu1r9d6h.dlg@40tude.net>
In reply to#9224
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.

[toc] | [prev] | [next] | [standalone]


#9227

FromScott Johnson <noonehome@chalupasworld.com>
Date2013-05-01 12:19 -0700
Message-ID<klrpml$27m$1@dont-email.me>
In reply to#9224
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

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.php


csiph-web