Advertisement
Guest User

Untitled

a guest
Sep 28th, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <?php
  2. $servername = "localhost";
  3. $username = "root";
  4. $password =
  5. $dbName = "twitchheroes";
  6.  
  7. //passed variables
  8. $query = $_POST["queryPost"];
  9. $action = $_POST["action"];
  10.  
  11. if (action == "initialize) {
  12.  
  13. //Make Connection
  14. $conn = new mysqli($servername, $username, $password, $dbName);
  15.  
  16.  
  17. //Check Connection
  18. if(!$conn){
  19. die("Connection Failed. ". mysqli_connect_error());
  20. }
  21.  
  22. }
  23.  
  24. if (action == "queryItems") {
  25.  
  26. $result = mysqli_query($conn, $query);
  27.  
  28. if ($result->num_rows > 0) {
  29. // output data of each row
  30. while($row = $result->fetch_assoc()) {
  31. echo $row["item_id"];
  32. echo "|";
  33. echo $row["item_name"];
  34. echo "|";
  35. echo $row["armor_type"];
  36. echo "|";
  37. echo $row["item_level"];
  38. echo "|";
  39. echo $row["damage"];
  40. echo "|";
  41. echo $row["health"];
  42. echo "|";
  43. echo $row["armor"];
  44. echo "|";
  45. echo $row["crit"];
  46. echo "|";
  47. echo $row["lifesteal"];
  48. echo "&";
  49. }
  50. } else {
  51. echo "no items";
  52. }
  53.  
  54. }
  55.  
  56. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement