<?php

    $Query 
$MySQL->query("SELECT `value` FROM `info` WHERE `name`='current_game'");
    
$Fetch $Query->fetch();
    
    
$QueryTwo $MySQL->prepare("SELECT * FROM `games` WHERE `id` < :one ORDER BY `id` DESC");
    
$QueryTwo->bindValue(":one"$Fetch['value'], PDO::PARAM_INT);
    
$QueryTwo->execute();
    
    while(
$FetchTwo $QueryTwo->fetch())
    {
        
        
$QueryThree $MySQL->prepare("SELECT `avatar`, `name` FROM `users` WHERE `steamid`=:one");
        
$QueryThree->bindValue(":one"$FetchTwo['userid'], PDO::PARAM_INT);
        
$QueryThree->execute();
        
$FetchThree $QueryThree->fetch();
        
        
$QueryFour $MySQL->prepare("SELECT * FROM :one");
        
$QueryFour->bindValue(":one"'game' $FetchTwo['id'], PDO::PARAM_STR);
        
$QueryFour->execute();
        
        while(
$FetchFour $QueryFour->fetch())
        {
            
            
$Data .= '<li>
            
                <a href="#">
                
                    <img src="http://steamcommunity-a.akamaihd.net/economy/image/'
.$FetchFour['image'].'/60fx60f" width="46" height="40">
                    <span class="tooltip">'
.$FetchFour['item'].' - $'.$FetchFour['value'].'</span>
                    
                </a>
            
            </li>'
;
            
        }
        
        
$Info .= '<li>
        
            <div class="visual">
            
                <img src="'
.$FetchThree['avatar'].'" width="105" height="105">
                <span class="num">'
.$FetchTwo['id'].'</span>
                
            </div>
            
            <div class="list" style=" margin-right: 50px; margin-bottom: 10px;">
            
                <ul>
                    
                    <li>'
.$FetchThree['name'].'</li>
                    
                    <li>
                        
                        <span>Szanse:</span>
                        <span class="price">'
.round($FetchTwo['percent'], 1).'%</span>
                    
                    </li>
                    
                    <li>
                        
                        <span>Wygrana:</span>
                        <span class="price">$'
.round($FetchTwo['cost'], 2).'</span>
                    
                    </li>
                
                </ul>
                
            </div>
            
            <div class="stuff" style="float: none; padding: 5px; width: 100%">
            
                <ul>'
.$Data.'</ul>
            
            </div>
        
        </li>'
;
        
    }

    
$View->Load('history');
    
$View->Add('info'$Info);
    
$View->Out();

?>