Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //--------------------
- // Gets JSON file
- $json = file_get_contents("adam/marketdata3.json"); // read file , is json type
- //die (htmlentities($json));
- $r=json_decode($json,true); // convert json to array
- /* echo "<hr><pre>";
- print_r($r);
- echo "</pre><hr>";
- */
- $numbers=explode(",",$cadena); // split item numbers to array
- foreach ($numbers as $item){ // walk array of number item, for prices
- //$item=20; // exmple
- // directly read in array of that item,m this is the magic
- $buyavg= $r[$item][buy][percentile];
- $sellavg= $r[$item][sell][percentile];
- $sql="update EVE_PRICES set BUY=$buyavg,SELL=$sellavg where ITEMID='$item'";
- //echo "<li>$sql";
- if ($buyavg=="" and $sellavg==''){
- echo "Nobody selling item $item: ".description($item);
- $buyavg=0;
- $sellavg=0;
- }
- $sql="update EVE_PRICES set BUY=$buyavg,SELL=$sellavg where ITEMID='$item'";
- mysql_query($sql) or die ("error 1231b:" .mysql_error()."<hr>$sql");
- } // each
- //}
- //--------------
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement