Jump to content

View image.


IamSuchANoob

Recommended Posts

Hi.

idea:

View image from /skins/ folder. The id for the image is taken from mysql DB field called PlayerDefaultSkin

 

So, lets say a user has 240 in the field in database and in /skins/ folder I have image called 240.png

What I want is to php read from PlayerDefaultSkin field and view the image from /skins/

 

Right now I have this:

query to update:

`PlayerDefaultSkin` = $data[PlayerDefaultSkin]'

 

and the output code

 

<img src="skins/<?php echo '$PlayerDefaultSkin' ?>.png">

 

which simply doesnt work and is probably very wrong.  So can anyone help me with this?

Link to comment
Share on other sites

i dont think you need the single quotes around the echo statement, but you do need them around the $data array,

try


$PlayerDefaultSkin = $data['PlayerDefaultSkin'];

<img src="skins/<?php echo $PlayerDefaultSkin; ?>.png">

 

also check src path, is it /skins/ or just skins/

Link to comment
Share on other sites

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /home/crpnet/domains/c-rp.net/public_html/UCPbeta/myaccount.php on line 53

 

Here is how the query looks right now:

mysql_query("UPDATE users SET
		`Hobby` = '$data[Hobby]',
		`Phone` = '$data[Phone]',
		`Gender` = '$data[Gender]',
		`Level` = '$data[Level]',
		`AdminLevel` = '$data[user_level]',
		`Job` = '$data[Job]',
		`Country` = '$data[Country]',
	    `MoneyInBank` = '$data[MoneyInBank]',
		`Age` = '$data[Age]',
		`PlayerMoney` = '$data[PlayerMoney]',
		$PlayerDefaultSkin = $data['PlayerDefaultSkin'];
		 WHERE id='$_SESSION[user_id]'
		") or die(mysql_error());

 

I think query works, it does output 240 as neccesary, problem is somewhere in here

           

<img src="skins/<?php echo $PlayerDefaultSkin; ?>.png">

but then again, what do I know?

 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.