config gets initialized in index.php (only if needed)

This commit is contained in:
Bryan Joshua Pedini 2021-01-05 14:23:42 +01:00
parent 20751112f6
commit 41a8adc3ea
1 changed files with 3 additions and 4 deletions

View File

@ -13,11 +13,10 @@
}
}
public function parse():void {
$config = new config();
$db = new database(host: $config->get("db.host"), user: $config->get("db.user"), pass: $config->get("db.pass"), name: $config->get("db.name"));
public function parse($db_config):void {
$db = new database(host: $db_config["host"], user: $db_config["user"], pass: $db_config["pass"], name: $db_config["name"]);
// Route Table Name
$rtn = $config->get("db.prefix")."routes";
$rtn = $db_config["prefix"]."routes";
$db->prepare("SELECT * FROM ".$rtn." WHERE ".$rtn.".uri = :request_uri");
$db->bind_and_execute([
":request_uri" => $this->request_uri,