Advertisement
Guest User

Untitled

a guest
May 23rd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.20 KB | None | 0 0
  1.   1  <?php
  2.   2 require_once 'include.php';
  3.   3
  4.   4 Class Database
  5.   5 {
  6.   6     //Propriedades
  7.   7     private $Hostname = "localhost";
  8.   8     private $Username = "tekwizz";
  9.   9     private $Password = "tekwizz";
  10.  10     private $Database = "tekwizz";
  11.  11     private $Connection;
  12.  12
  13.  13     //Construtores
  14.  14     public function __construct() {
  15.  15         $Connection = mysqli_connect($this->Hostname, $this->Username, $this->Password, $this->Database)
  16.  16             or die ("Erro na ligação à base de dados!");
  17.  17     }
  18.  18     //Métodos
  19.  19     //Retorna o dataset da query
  20.  20     //TODO: Fazer o parssing the SQL injection
  21.  21     public function Query($query) {
  22.  22         $recordset = mysqli_query($this->Connetion, $query)
  23.  23             or die("Foi inpossivel realizar o pedido");
  24.  24         return $recordset;
  25.  25     }
  26.  26     //Retorna um Array multidemensional com resultado total
  27.  27     public function Result($query) {
  28.  28         $result = new Array();
  29.  29         //TODO: Verficar se se chama o método sem o this ou com
  30.  30         while ($row = mysqli_fetch_assoc($this->Query($query)))
  31.  31             $result = $row;
  32.  32         return $result;
  33.  33     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement