Showing skin image in PHP
#1

Hello. How do I make my website display the skin image depending on what the players skin ID is saved in the database?
I have a Skins folder inside my website home directory and every skin image is saved like 0.jpg for CJ etc.

PHP код:
<?php 
include 'Config.php';
$signame $_GET['User'];
if (
$signame)
{
    
$connect mysql_connect($dbhost$dbuser$dbpass) or die ("Cannot Connect");
    
mysql_select_db($dbname) or die ("Data Base was not found");
    
$query "SELECT * FROM Accounts WHERE Name = '$signame'";
    
$results mysql_query($query);
    while(
$row mysql_fetch_array($results)) 
    {
        
$username $row['Name'];
        
$Score $row['Level'];
        
$Cash $row['Cash'];
        
$Bank $row['Bank'];
        
$House $row['House'];
        
$Skin 'Skins/';
        
$Skin .= $row['Skin'];
        
$Skin .= '.jpg';
        echo 
'' .$Skin'<br><br>'/* This just displays "Skins/34.jpg", I need it to fetch the image from folder */
        
echo 'Character:   ' .$username'<br>';
        echo 
'Level: ' .$Score'<br>';
        echo 
'Cash:   $' .$Cash'<br>';
        echo 
'Bank:   $' .$Bank'<br>';
        if(
$House != 0)
        {
            include 
'House.php';
        }
        else
        {
            echo 
'Address: None';
        }
    }
} else die(
"Didn't log in to check the database.");
?>
Reply
#2

PHP код:
echo '<img src="Skins/'.$row['Skin'].'.jpg" />'
Something like that should work.
Reply
#3

Quote:
Originally Posted by Luis-
Посмотреть сообщение
PHP код:
echo '<img src="Skins/'.$row['Skin'].'.jpg" />'
Something like that should work.
You legend! +rep
Reply
#4

Glad it worked!
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)