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
https://forums.phpfreaks.com/topic/234677-view-image/
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
https://forums.phpfreaks.com/topic/234677-view-image/#findComment-1205972
Share on other sites

Archived

This topic is now archived and is closed to further replies.

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