Advertisement
Guest User

Untitled

a guest
Nov 12th, 2019
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. <?php
  2.  
  3. require '../database.php';
  4.  
  5. function getTeams() {
  6.  
  7. global $db;
  8.  
  9. $query = "SELECT * FROM TEAMS";
  10.  
  11. $statement = $db->prepare($query);
  12.  
  13. try {
  14. $query->execute();
  15. } catch (PDOException $ex) {
  16.  
  17. }
  18.  
  19. $teams = $statement->fetchAll();
  20. $statement->closeCursor();
  21.  
  22. return $teams;
  23. }
  24.  
  25. function getTeamByID($teamId) {
  26. global $db;
  27. $query = "SELECT teams.name,results.homeGoal,results.awayGoal FROM TEAMs,results WHERE teams.id=$teamId AND homeTeam=$teamId;";
  28.  
  29. $statement = $db->prepare($query);
  30.  
  31. try {
  32. $query->execute();
  33. } catch (PDOException $ex) {
  34.  
  35. }
  36.  
  37. $team = $statement->fetchAll();
  38. $statement->closeCursor();
  39.  
  40. return $team;
  41. }
  42.  
  43. function get2Teams($team1, $team2) {
  44. global $db;
  45. $query = "SELECT * FROM results where (awayTeam=$team1 or homeTeam=$team1) and (awayTeam=$team2 or homeTeam=$team2);";
  46.  
  47. $statement = $db->prepare($query);
  48.  
  49. try {
  50. $statement->execute();
  51. } catch (PDOException $ex) {
  52.  
  53. }
  54.  
  55. $teamsVs = $statement->fetchAll();
  56. $statement->closeCursor();
  57.  
  58. return $teamsVs;
  59. }
  60.  
  61. ini_set("soap.wsdl_cache_enabled", "0");
  62. $server = new SoapServer("ca1.wsdl");
  63. $server->addFunction("getTeams");
  64. $server->addFunction("getTeamByID");
  65. $server->addFunction("get2Teams");
  66. $server->handle();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement