-4
Good is the following I have the following code that causes you to take all items/weapons from the inventory of a particular individual and show it.
Well what I wanted to know is how do I do apart from picking up the items say the status of the item, like:
Sawed-Off | Full Stop (Field-Tested)
My Code:
<?php
$steamid = '76561198103888786';
$destUrl = 'http://steamcommunity.com/profiles/' . $steamid . '/inventory/json/730/2/';
$data = file_get_contents($destUrl, false);
$data = json_decode($data, true);
$data1= array_keys($data['rgDescriptions']);
$data2= $data['rgDescriptions'];
for($i = 0; $i < count($data1); ++$i) {
$items = $data2[$data1[$i]]['name'];
echo $items;
echo "<br>";
}
?>
I could perfectly get all the items, now in the case how would I put each item in 1 variable in the case, $item1 = first item, $item2 = second item, $item3 = third item, how can I do this, so I can insert all the player’s items in the bd.?
– Gonçalo
There are several ways. I, today, would do so:
$inventario[] = "(0, $usuario, $name, $market_hash, $market_name)"
, within thefor
. Then I would make a$valores = implode(',', $inventario)
. That way it would be enough to make aINSERT INTO tabela VALUES $valores
. On test would stay:INSERT INTO tabela VALUES (0,1,2,3,4), (0,1,7,8,9), (0,1,3,4,5)
, for example. I answered a similar question without using theimplode
, but with the same idea in http://answall.com/questions/112798/como-fazer-v%C3%A1rios-registros-de-checkbox-no-banco-de-uma-s%C3%B3-vez/112809#112809.– Inkeliz
Can you edit your answer with this to get more organized? Thank you.
– Gonçalo