1
<?php
  if($skin > 0 && $skin < 100)
  {
    $imagename = "www.xxxxxxxxxxxxx.com/pcp/Skins/Skin_0".$skin.".png";
  }
  else
  {
    $imagename = "www.xxxxxxxxxxxxx.com/pcp/Skins/Skin_".$skin.".png";
  }
  echo '<img src='.$imagename.' class="floatRight">';
?>

I tried this, but it doesn't seem to work, I viewed the source code and this appaered:

"www.xxxxxxxxxxxxx.com/pcp/Skins/Skin_.png class="floatRight">"

Nitsan Baleli
  • 5,393
  • 3
  • 30
  • 52

4 Answers4

0

use double quotes:

echo "<img src='$imagename' class='floatRight'>";

read this answer on the difference between single-quoted and double-quoted strings in PHP.

Community
  • 1
  • 1
Nitsan Baleli
  • 5,393
  • 3
  • 30
  • 52
  • IT does not solve the issue unless you add the single quotes around `$imagename` as well like around `floatRight`. – fejese Nov 10 '14 at 08:52
0

image link add http:// prefix

$imagename = "http://www.xxxxxxxxxxxxx.com/pcp/Skins/Skin_".$skin.".png";

or

don't write domain name

$imagename = "/pcp/Skins/Skin_".$skin.".png";
masouk
  • 576
  • 4
  • 8
0

if you are getting this:

"www.xxxxxxxxxxxxx.com/pcp/Skins/Skin_.png class="floatRight">"

in your source code then i guess the problem is with $skin variable please check is this an array or not if so then use $skin[index].

here:

$imagename = "www.xxxxxxxxxxxxx.com/pcp/Skins/Skin_0".$skin.".png";
PHP Worm...
  • 4,109
  • 1
  • 25
  • 48
0

use like :-

echo '<img src="'.$imagename.'" class="floatRight">';

this may help you.

Param Kumar
  • 123
  • 3
  • 18