SA-MP Forums Archive
Showing skin image in PHP - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Showing skin image in PHP (/showthread.php?tid=510559)



Showing skin image in PHP - AphexCCFC - 01.05.2014

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.");
?>



Re: Showing skin image in PHP - Luis- - 01.05.2014

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


Re: Showing skin image in PHP - AphexCCFC - 01.05.2014

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


Re: Showing skin image in PHP - Luis- - 01.05.2014

Glad it worked!