0

So i want to search for a specific value (price) in the db like this:

<?php
include 'settings.php';

        // Create connection
        $conn = mysqli_connect($servername, $username, $password, $dbname);
        // Check connection
        if (!$conn) {
            die("Connection failed: " . mysqli_connect_error());
        }

$steamData = file_get_contents("http://steamcommunity.com/profiles/76561198258195397/inventory/json/730/2");
$data = json_decode($steamData, true);
$items = $data['rgDescriptions'];
foreach($items as $key => $item){
        $name = $item["market_hash_name"];
        $query = "SELECT price FROM itemprice WHERE market_hash_name = '$name'";
        $result = mysql_query($query) or die($query."<br/><br/>".mysql_error());
        $price = mysql_result($result, 0);
        echo '<div class="items"><center><img src="http://steamcommunity-a.akamaihd.net/economy/image/' . $item["icon_url"] . '" height="192" width="256"></center><div><center><h5 style="color:#'.$item["name_color"].'">'.$item["market_name"].'<br>'.$price.'</h5></center></div><br></div>';
    } 

mysqli_close($conn);
?>

It says: SELECT price FROM itemprice WHERE market_hash_name = StatTrak™ AK-47 | Elite Build (Well-Worn)

Access denied for user 'xxxxxxx'@'localhost' (using password: NO)

0 Answers0