Advertisement
KeenanLeeArcher

Untitled

Jan 29th, 2020
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. <?php
  2. require_once __DIR__ . '/config.php';
  3. class API {
  4. function Select(){
  5. $db = new Connect;
  6. $games = array();
  7. $cheats = array();
  8.  
  9. $data = $db->prepare('SELECT name,title,version,image_url FROM games ORDER BY title ASC');
  10. $data->execute();
  11. while($outputData = $data->fetch(PDO::FETCH_ASSOC)){
  12. $games[] = $outputData;
  13. }
  14. $data1 = $db->prepare('SELECT name, title, des,mods,type FROM cheats ORDER BY title ASC');
  15. $data1->execute();
  16. while($outputData = $data1->fetch(PDO::FETCH_ASSOC)){
  17.  
  18. $cheats[] = $outputData;
  19.  
  20. }
  21.  
  22. $data2 = $db->prepare('SELECT * FROM settings');
  23. $data2->execute();
  24. while($outputData = $data2->fetch(PDO::FETCH_ASSOC)){
  25.  
  26. $users[] = $outputData;
  27.  
  28. }
  29. $Output=array('games'=>$games,'cheats'=>$cheats, 'settings'=>$users);
  30. echo(json_encode($Output,JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE| JSON_UNESCAPED_SLASHES));
  31. }
  32. }
  33.  
  34. $API = new API;
  35. header('Content-type: application/json; charset=utf-8');
  36. echo $API->Select();
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement