Advertisement
WhiteGazelle

player

Feb 26th, 2019
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.79 KB | None | 0 0
  1. <?php
  2.  
  3. //include('config.php');
  4.  
  5. class player
  6. {
  7.     private $mysql;
  8.     private $db;
  9.    
  10.     public function __construct($_mysql, $_db)
  11.     {
  12.         $this->mysql = $_mysql;
  13.         $this->db = $_db;
  14.     }
  15.    
  16.     public function getPlayerInfo()
  17.     {
  18.         $this->mysql->query("use " . $this->db);
  19.         $stmt = $this->mysql->prepare("SELECT p.name, p.age, p.height, p.nationality, p.position, pa.*
  20.                                        FROM players AS p
  21.                                        INNER JOIN playerattributes pa
  22.                                        ON p.id = pa.player_id");
  23.         if(!$stmt->execute())
  24.             return false;
  25.         $result = $stmt->get_result();
  26.         $data = mysqli_fetch_array($result);
  27.         return $data;
  28.        
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement