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