0

Hi all,
I use glossy.js and I am trying to apply it in an image with the path like

<img src="../Users/admin/header1.gif" class="glossy"/>

the effect is ok.

But when I am trying this in a php code like

echo '<img src="../Users/$user[username]/$photo[filename]" class="glossy"/>';

then it does not work.

I have checked $user[username], $photo[filename]

What am I doing wrong ?

thanks in advance

2
Contributors
2
Replies
3
Views
7 Years
Discussion Span
Last Post by bufospro
0

You can't enclose variables inside single quotes:

This'll work:

echo '<img src="../Users/' . $user['username'] . '/' . $photo['filename'] . '" class="glossy"/>';

As will this:

echo "<img src=\"../Users/{$user['username']}/{$photo['filename']}\" class=\"glossy\" />";

Unless I've made some typos.

If you include array variables within double quotes, they must be 'braced out' ({...})

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.