Advertisement
Guest User

Untitled

a guest
Feb 14th, 2020
1,015
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.34 KB | None | 0 0
  1. <?php
  2. $servername = "IP";
  3. $username = "username";
  4. $password = "password";
  5. $dbname = "databasename";
  6.  
  7. // Create connection
  8. $conn = new mysqli($servername, $username, $password, $dbname);
  9. // Check connection
  10. if ($conn->connect_error) {
  11.     die("Connection failed: " . $conn->connect_error);
  12. }
  13.  
  14. //$sql = "SELECT * FROM users where loadout LIKE '%WEAPON%'";
  15. $sql = "SELECT * FROM users where 1=1";
  16.  
  17. $result = $conn->query($sql);
  18.  
  19. $x = 0;
  20.  
  21. if ($result->num_rows > 0) {
  22.     // output data of each row
  23.     while($row = $result->fetch_assoc()) {
  24.         $sql_inv = "SELECT * FROM user_inventory where identifier = '".$row["identifier"]."' AND count > 0";
  25.         $result_inventario = $conn->query($sql_inv);
  26.         if ($result_inventario->num_rows > 0) {
  27.             echo "<b style='color#ff0000;'>inventario</b><br>";
  28.             $playeritems = array();
  29.             while($row_inv = $result_inventario->fetch_assoc()) {
  30.            
  31.                 $playeritems[$row_inv["item"]] = intval($row_inv["count"]);
  32.  
  33.             }
  34.             $inventoriodojogador = "";
  35.             $inventoriodojogador = json_encode($playeritems);
  36.  
  37.             $sqlupdate = "UPDATE users SET inventory = '".$inventoriodojogador."' where identifier = '".$row["identifier"]."'";
  38.             $result_inventario = $conn->query($sqlupdate);
  39.             echo $inventoriodojogador;
  40.             $x++;
  41.         }
  42.  
  43.        
  44.  
  45.  
  46.  
  47.  
  48.  
  49.  
  50.  
  51. }
  52. } else {
  53.     echo "0 results";
  54. }
  55.  
  56. echo $x;
  57.  
  58.  
  59.  
  60. echo "<hr>";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement