I have 2 classes and I would like to have 1 more for comfort :)
So I have class for database and system. I would like to have 3rd classs for functions. This class MUST use functions from database since there are SQL Queries. This is What I ended with:
class database {
public function __construct() {
$this->mysqli = new mysqli('localhost', 'root', '', 'roids');
$this->func = new functions();
}
}
class functions {
function __construct(){
$db = new database();
}
public function banned() {
$q = $db->select($this->prefix."banned", "*", "banned_ip", $this->getIP());
if (0 == 0) {
header('Location: banned.php'); // For testing
}
}
}
And I this kind of version ends in cycle. Any solutions ? Thanks a lot
functionsclass. You can have a "user". You can have a "database". But you cannot have a "functions".