We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d692791 commit 09d4784Copy full SHA for 09d4784
src/Model.php
@@ -1,10 +1,20 @@
1
<?php
2
namespace PHPRed;
3
4
-class Model extends PHPRed
+abstract class Model extends PHPRed
5
{
6
+ public $model;
7
+ public $table;
8
+
9
public function __construct(\mysqli $mysqli)
10
11
parent::__construct($mysqli);
12
}
13
14
+ public function getAll()
15
+ {
16
+ $query = "SELECT * FROM $this->table;";
17
+ $results = $this->mysqli->query($query);
18
+ return $this->toArray($results);
19
+ }
20
src/PHPRed.php
@@ -1,12 +1,17 @@
-class PHPRed
+abstract class PHPRed
- private $mysqli;
+ protected $mysqli;
$this->mysqli = $mysqli;
+ protected function toArray(\mysqli_result $results) : array
+ return $results->fetch_array(MYSQLI_ASSOC);
0 commit comments