From 067e78d5d64adbf52c911f0f65cdaa7f8156e903 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 31 Mar 2021 20:41:37 +0300 Subject: Added database initialisation to DB model; added a script for watching file changes --- src/models/DB.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/models/DB.php (limited to 'src/models/DB.php') diff --git a/src/models/DB.php b/src/models/DB.php new file mode 100644 index 0000000..f6db512 --- /dev/null +++ b/src/models/DB.php @@ -0,0 +1,31 @@ +connection = mysqli_connect(self::$servername, self::$username, self::$password); + + if (!$this->connection) { + die(mysqli_connect_error()); + } + + // Make sure the actual db exists + $createDBQuery = "CREATE DATABASE IF NOT EXISTS " . self::$dbname . ";"; + + if (!mysqli_query($this->connection, $createDBQuery)) { + die(mysqli_error($this->connection)); + } + + // Make the actual connection to the database + mysqli_select_db($this->connection, self::$dbname); + } + + function __destruct() { + mysqli_close($this->connection); + } +} -- cgit v1.3.1-23-gd82d From eee825eb3ed35268c647a0e50904197eb2e953c5 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Wed, 31 Mar 2021 21:40:34 +0300 Subject: Added JobOffer model and implemented a basic system for creating tables --- src/models/DB.php | 27 +++++++++++++++++++++++++++ src/models/JobOffer.php | 18 ++++++++++++++++++ 2 files changed, 45 insertions(+) create mode 100644 src/models/JobOffer.php (limited to 'src/models/DB.php') diff --git a/src/models/DB.php b/src/models/DB.php index f6db512..1ca0137 100644 --- a/src/models/DB.php +++ b/src/models/DB.php @@ -1,10 +1,16 @@ connection, self::$dbname); + + $this->createTables(); + } + + private function createTables() { + $this->createTable(JobOffer::TABLE_NAME, JobOffer::TABLE_COLUMNS); } function __destruct() { mysqli_close($this->connection); } + + function createTable(string $tableName, array $columns) { + $query = "CREATE TABLE IF NOT EXISTS {$tableName}( + id INT NOT NULL AUTO_INCREMENT,"; + + foreach ($columns as $column) { + $query .= "{$column},"; + } + + $query .= "PRIMARY KEY (id));"; + + if (!mysqli_query($this->connection, $query)) { + die(mysqli_error($this->connection)); + } + } } diff --git a/src/models/JobOffer.php b/src/models/JobOffer.php new file mode 100644 index 0000000..1fb3d28 --- /dev/null +++ b/src/models/JobOffer.php @@ -0,0 +1,18 @@ +db = $db; + } +} -- cgit v1.3.1-23-gd82d From 279be0402dfa61597f409359cc139c2b2cd14f66 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 09:13:10 +0300 Subject: Updated DB to use PDO instead of mysqli --- src/models/DB.php | 38 +++++++++++++------------------------- 1 file changed, 13 insertions(+), 25 deletions(-) (limited to 'src/models/DB.php') diff --git a/src/models/DB.php b/src/models/DB.php index 1ca0137..77e08a5 100644 --- a/src/models/DB.php +++ b/src/models/DB.php @@ -1,6 +1,4 @@ connection = mysqli_connect(self::$servername, self::$username, self::$password); - - if (!$this->connection) { - die(mysqli_connect_error()); - } + $this->connection = new PDO("mysql:host=" . self::$servername, self::$username, self::$password); + $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Make sure the actual db exists $createDBQuery = "CREATE DATABASE IF NOT EXISTS " . self::$dbname . ";"; - if (!mysqli_query($this->connection, $createDBQuery)) { - die(mysqli_error($this->connection)); - } + $this->connection->exec($createDBQuery); // Make the actual connection to the database - mysqli_select_db($this->connection, self::$dbname); - - $this->createTables(); - } - - private function createTables() { - $this->createTable(JobOffer::TABLE_NAME, JobOffer::TABLE_COLUMNS); - } - - function __destruct() { - mysqli_close($this->connection); + $this->connection->exec("USE " . self::$dbname); } function createTable(string $tableName, array $columns) { @@ -51,8 +34,13 @@ class DB { $query .= "PRIMARY KEY (id));"; - if (!mysqli_query($this->connection, $query)) { - die(mysqli_error($this->connection)); - } + $this->connection->exec($query); + } + + function getAllValues(string $tableName) { + $sth = $this->connection->prepare("SELECT * FROM `{$tableName}`"); + $sth->execute(); + + return $sth->fetchAll(PDO::FETCH_OBJ); } } -- cgit v1.3.1-23-gd82d From e9ba7fbcff47f0e4a03d74b857e9864d67a8b163 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 09:37:42 +0300 Subject: Implemented value insertion into DB --- src/index.php | 5 +++-- src/models/DB.php | 18 ++++++++++++++++++ src/models/JobOffer.php | 4 ++++ 3 files changed, 25 insertions(+), 2 deletions(-) (limited to 'src/models/DB.php') diff --git a/src/index.php b/src/index.php index 5fefff4..ecebcd9 100644 --- a/src/index.php +++ b/src/index.php @@ -2,8 +2,9 @@ $obj) { - echo $obj->id . "
"; + echo "{$obj->id} {$obj->title}
"; } ?> diff --git a/src/models/DB.php b/src/models/DB.php index 77e08a5..299b05a 100644 --- a/src/models/DB.php +++ b/src/models/DB.php @@ -43,4 +43,22 @@ class DB { return $sth->fetchAll(PDO::FETCH_OBJ); } + + function insertValue(string $tableName, ...$values) { + $query = "INSERT INTO {$tableName} VALUES(NULL, "; + + foreach($values as $value) { + if (gettype($value) == "string") { + $query .= "'{$value}', "; + } + else { + $query .= "{$value}, "; + } + } + $query = rtrim($query, ", "); + + $query .= ");"; + + $this->connection->exec($query); + } } diff --git a/src/models/JobOffer.php b/src/models/JobOffer.php index 736d644..7603211 100644 --- a/src/models/JobOffer.php +++ b/src/models/JobOffer.php @@ -25,4 +25,8 @@ class JobOffer extends DBModel { static function getAll() { return self::$DB->getAllValues(self::TABLE_NAME); } + + static function insertInDB(JobOffer $jb) { + self::$DB->insertValue(self::TABLE_NAME, $jb->title, $jb->description, $jb->company, $jb->salary); + } } -- cgit v1.3.1-23-gd82d From f9e2090a1028712ecc6e1b0c71390c821689b414 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 09:43:48 +0300 Subject: Implemented getById from DB and changed some method names --- src/index.php | 8 ++++++-- src/models/DB.php | 7 +++++++ src/models/JobOffer.php | 11 +++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) (limited to 'src/models/DB.php') diff --git a/src/index.php b/src/index.php index ecebcd9..55bba39 100644 --- a/src/index.php +++ b/src/index.php @@ -3,8 +3,12 @@ include_once("models/JobOffer.php"); $jb = new JobOffer("Test", "A test", "TheTest", 11); - JobOffer::insertInDB($jb); - foreach(JobOffer::getAll() as $key => $obj) { + // JobOffer::insertInDB($jb); + foreach(JobOffer::getAllFromDB() as $key => $obj) { echo "{$obj->id} {$obj->title}
"; } + echo "
"; + + $gottenjb = JobOffer::getFromDBById(1); + echo $gottenjb->title; ?> diff --git a/src/models/DB.php b/src/models/DB.php index 299b05a..b973e4b 100644 --- a/src/models/DB.php +++ b/src/models/DB.php @@ -37,6 +37,13 @@ class DB { $this->connection->exec($query); } + function getById(string $tableName, int $id) { + $sth = $this->connection->prepare("SELECT * FROM `{$tableName}` WHERE id = {$id}"); + $sth->execute(); + + return $sth->fetch(PDO::FETCH_OBJ); + } + function getAllValues(string $tableName) { $sth = $this->connection->prepare("SELECT * FROM `{$tableName}`"); $sth->execute(); diff --git a/src/models/JobOffer.php b/src/models/JobOffer.php index 7603211..3bb1791 100644 --- a/src/models/JobOffer.php +++ b/src/models/JobOffer.php @@ -19,14 +19,21 @@ class JobOffer extends DBModel { self::$DB->createTable(self::TABLE_NAME, self::TABLE_COLUMNS); } + /** + * @return JobOffer + */ + static function getFromDBById(int $id) { + return self::$DB->getById(self::TABLE_NAME, $id); + } + /** * @return JobOffer[] */ - static function getAll() { + static function getAllFromDB() { return self::$DB->getAllValues(self::TABLE_NAME); } - static function insertInDB(JobOffer $jb) { + static function insertIntoDB(JobOffer $jb) { self::$DB->insertValue(self::TABLE_NAME, $jb->title, $jb->description, $jb->company, $jb->salary); } } -- cgit v1.3.1-23-gd82d From 30ee8530a646d3dcf32d563bbf42475035449bb5 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 10:13:17 +0300 Subject: Implemented update from DB and updated some comments and phpdocumentator tags --- src/index.php | 6 ++++++ src/models/DB.php | 40 ++++++++++++++++++++++++++++++---------- src/models/JobOffer.php | 21 +++++++++++++++++++-- 3 files changed, 55 insertions(+), 12 deletions(-) (limited to 'src/models/DB.php') diff --git a/src/index.php b/src/index.php index 55bba39..6478815 100644 --- a/src/index.php +++ b/src/index.php @@ -11,4 +11,10 @@ $gottenjb = JobOffer::getFromDBById(1); echo $gottenjb->title; + + $gottenjb->title = "Something even newer"; + echo $gottenjb->title; + JobOffer::updateFromDB($gottenjb); + $secgot = JobOffer::getFromDBById(1); + echo $secgot->title; ?> diff --git a/src/models/DB.php b/src/models/DB.php index b973e4b..4c75d17 100644 --- a/src/models/DB.php +++ b/src/models/DB.php @@ -24,6 +24,8 @@ class DB { $this->connection->exec("USE " . self::$dbname); } + /* Create */ + function createTable(string $tableName, array $columns) { $query = "CREATE TABLE IF NOT EXISTS {$tableName}( id INT NOT NULL AUTO_INCREMENT,"; @@ -37,6 +39,26 @@ class DB { $this->connection->exec($query); } + function insertValue(string $tableName, ...$values) { + $query = "INSERT INTO {$tableName} VALUES(NULL, "; + + foreach($values as $value) { + if (gettype($value) == "string") { + $query .= "'{$value}', "; + } + else { + $query .= "{$value}, "; + } + } + $query = rtrim($query, ", "); + + $query .= ");"; + + $this->connection->exec($query); + } + + /* Read */ + function getById(string $tableName, int $id) { $sth = $this->connection->prepare("SELECT * FROM `{$tableName}` WHERE id = {$id}"); $sth->execute(); @@ -51,20 +73,18 @@ class DB { return $sth->fetchAll(PDO::FETCH_OBJ); } - function insertValue(string $tableName, ...$values) { - $query = "INSERT INTO {$tableName} VALUES(NULL, "; + /* Update */ - foreach($values as $value) { - if (gettype($value) == "string") { - $query .= "'{$value}', "; - } - else { - $query .= "{$value}, "; - } + function updateById(string $tableName, int $id, ...$values) { + $query = "UPDATE {$tableName} SET "; + + for ($i = 0; $i < sizeof($values); $i += 2) { + $query .= "{$values[$i]} = " . (gettype($values[$i+1]) == "string" ? "'{$values[$i+1]}'" : $values[$i+1]) . ", "; } $query = rtrim($query, ", "); - $query .= ");"; + $query .= " WHERE id = {$id};"; + echo $query; $this->connection->exec($query); } diff --git a/src/models/JobOffer.php b/src/models/JobOffer.php index 3bb1791..2627207 100644 --- a/src/models/JobOffer.php +++ b/src/models/JobOffer.php @@ -19,6 +19,17 @@ class JobOffer extends DBModel { self::$DB->createTable(self::TABLE_NAME, self::TABLE_COLUMNS); } + /* Create */ + + /** + * @param JobOffer $jb + */ + static function insertIntoDB($jb) { + self::$DB->insertValue(self::TABLE_NAME, $jb->title, $jb->description, $jb->company, $jb->salary); + } + + /* Read */ + /** * @return JobOffer */ @@ -33,7 +44,13 @@ class JobOffer extends DBModel { return self::$DB->getAllValues(self::TABLE_NAME); } - static function insertIntoDB(JobOffer $jb) { - self::$DB->insertValue(self::TABLE_NAME, $jb->title, $jb->description, $jb->company, $jb->salary); + /* Update */ + + /** + * @param JobOffer $jb + */ + static function updateFromDB($jb) { + echo "here"; + self::$DB->updateById(self::TABLE_NAME, $jb->id, "title", $jb->title, "description", $jb->description, "company", $jb->company, "salary", $jb->salary); } } -- cgit v1.3.1-23-gd82d From 852e91a3da52a478c942bf7a664df8d8798b0641 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 10:26:26 +0300 Subject: Implemented delete from DB and added error handling to queries --- src/index.php | 2 ++ src/models/DB.php | 42 ++++++++++++++++++++++++++++++++++++------ src/models/JobOffer.php | 7 ++++++- 3 files changed, 44 insertions(+), 7 deletions(-) (limited to 'src/models/DB.php') diff --git a/src/index.php b/src/index.php index 6478815..7120cd3 100644 --- a/src/index.php +++ b/src/index.php @@ -17,4 +17,6 @@ JobOffer::updateFromDB($gottenjb); $secgot = JobOffer::getFromDBById(1); echo $secgot->title; + + JobOffer::deleteFromDB(3); ?> diff --git a/src/models/DB.php b/src/models/DB.php index 4c75d17..b287273 100644 --- a/src/models/DB.php +++ b/src/models/DB.php @@ -12,8 +12,13 @@ class DB { private PDO $connection; function __construct() { - $this->connection = new PDO("mysql:host=" . self::$servername, self::$username, self::$password); - $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + try { + $this->connection = new PDO("mysql:host=" . self::$servername, self::$username, self::$password); + $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); + } + catch (PDOException $e) { + echo "[DB Exception]: " . $e->getMessage(); + } // Make sure the actual db exists $createDBQuery = "CREATE DATABASE IF NOT EXISTS " . self::$dbname . ";"; @@ -36,7 +41,12 @@ class DB { $query .= "PRIMARY KEY (id));"; - $this->connection->exec($query); + try { + $this->connection->exec($query); + } + catch (PDOException $e) { + echo "[DB Exception]: " . $e->getMessage(); + } } function insertValue(string $tableName, ...$values) { @@ -54,7 +64,12 @@ class DB { $query .= ");"; - $this->connection->exec($query); + try { + $this->connection->exec($query); + } + catch (PDOException $e) { + echo "[DB Exception]: " . $e->getMessage(); + } } /* Read */ @@ -84,8 +99,23 @@ class DB { $query = rtrim($query, ", "); $query .= " WHERE id = {$id};"; - echo $query; - $this->connection->exec($query); + try { + $this->connection->exec($query); + } + catch (PDOException $e) { + echo "[DB Exception]: " . $e->getMessage(); + } + } + + /* Delete */ + + function deleteById(string $tableName, int $id) { + try { + $this->connection->exec("DELETE FROM {$tableName} WHERE id = {$id}"); + } + catch (PDOException $e) { + echo "[DB Exception]: " . $e->getMessage(); + } } } diff --git a/src/models/JobOffer.php b/src/models/JobOffer.php index 2627207..5d89048 100644 --- a/src/models/JobOffer.php +++ b/src/models/JobOffer.php @@ -50,7 +50,12 @@ class JobOffer extends DBModel { * @param JobOffer $jb */ static function updateFromDB($jb) { - echo "here"; self::$DB->updateById(self::TABLE_NAME, $jb->id, "title", $jb->title, "description", $jb->description, "company", $jb->company, "salary", $jb->salary); } + + /* Delete */ + + static function deleteFromDB(int $id) { + self::$DB->deleteById(self::TABLE_NAME, $id); + } } -- cgit v1.3.1-23-gd82d From 83bb68e766bf12c5c48350bd6d9f8237e301882c Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 11:22:04 +0300 Subject: Added and improved existing phpdocumentator documentation --- src/index.php | 11 ----------- src/models/DB.php | 39 ++++++++++++++++++++++++++++++++++++++- src/models/DBModel.php | 5 ++++- src/models/JobOffer.php | 15 +++++++++++++++ 4 files changed, 57 insertions(+), 13 deletions(-) (limited to 'src/models/DB.php') diff --git a/src/index.php b/src/index.php index 7120cd3..fb5e85e 100644 --- a/src/index.php +++ b/src/index.php @@ -8,15 +8,4 @@ echo "{$obj->id} {$obj->title}
"; } echo "
"; - - $gottenjb = JobOffer::getFromDBById(1); - echo $gottenjb->title; - - $gottenjb->title = "Something even newer"; - echo $gottenjb->title; - JobOffer::updateFromDB($gottenjb); - $secgot = JobOffer::getFromDBById(1); - echo $secgot->title; - - JobOffer::deleteFromDB(3); ?> diff --git a/src/models/DB.php b/src/models/DB.php index b287273..dc69cfe 100644 --- a/src/models/DB.php +++ b/src/models/DB.php @@ -1,4 +1,7 @@ connection = new PDO("mysql:host=" . self::$servername, self::$username, self::$password); $this->connection->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); @@ -25,12 +29,21 @@ class DB { $this->connection->exec($createDBQuery); - // Make the actual connection to the database + // Connect to the actual database $this->connection->exec("USE " . self::$dbname); } /* Create */ + /** + * Creates a table, with the given name and given column information. + * **WARNING**: The method also creates an auto-incremented int id column, **DO NOT** specify it! + * + * @param string[] $columns + * Represents the column information. Each value must be like: "column_name data_type", where the data_type should be taken + * from the constant values of DB class. + * Example value: array("first_name " . DB::STRING_TYPE, "age " . DB::INTEGER_TYPE, "income " . DB::FLOAT_TYPE) + */ function createTable(string $tableName, array $columns) { $query = "CREATE TABLE IF NOT EXISTS {$tableName}( id INT NOT NULL AUTO_INCREMENT,"; @@ -49,6 +62,14 @@ class DB { } } + /** + * Inserts a value in a given table. + * + * @param string[] $values + * Represents the data that should be inserted. The values should be ordered the same way the table columns are ordered. + * Example: "John", 20, 2000.3 + * **WARNING**: DO NOT insert the id value + */ function insertValue(string $tableName, ...$values) { $query = "INSERT INTO {$tableName} VALUES(NULL, "; @@ -74,6 +95,9 @@ class DB { /* Read */ + /** + * Returns the next value that has the given id. + */ function getById(string $tableName, int $id) { $sth = $this->connection->prepare("SELECT * FROM `{$tableName}` WHERE id = {$id}"); $sth->execute(); @@ -81,6 +105,9 @@ class DB { return $sth->fetch(PDO::FETCH_OBJ); } + /** + * Returns all values inside a table. + */ function getAllValues(string $tableName) { $sth = $this->connection->prepare("SELECT * FROM `{$tableName}`"); $sth->execute(); @@ -90,6 +117,13 @@ class DB { /* Update */ + /** + * Updates the value with the given id inside the specified table. + * + * @param string[] $values + * Represents the data that should be updated. There should always be an even amount of data, where you alternate the column name and column value. + * Example: "first_name", "John", "age", 20, "income", 2000.3 + */ function updateById(string $tableName, int $id, ...$values) { $query = "UPDATE {$tableName} SET "; @@ -110,6 +144,9 @@ class DB { /* Delete */ + /** + * Deletes the value with the given id inside the given table. + */ function deleteById(string $tableName, int $id) { try { $this->connection->exec("DELETE FROM {$tableName} WHERE id = {$id}"); diff --git a/src/models/DBModel.php b/src/models/DBModel.php index 859ea97..4e10c18 100644 --- a/src/models/DBModel.php +++ b/src/models/DBModel.php @@ -1,9 +1,12 @@ deleteById(self::TABLE_NAME, $id); } -- cgit v1.3.1-23-gd82d From 73df4ef3ee7d01bbdd8af367de0439e190ff5350 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 12:23:01 +0300 Subject: Added DB support for foreign keys --- src/models/DB.php | 27 +++++++++++++++++++++++---- 1 file changed, 23 insertions(+), 4 deletions(-) (limited to 'src/models/DB.php') diff --git a/src/models/DB.php b/src/models/DB.php index dc69cfe..9fd705c 100644 --- a/src/models/DB.php +++ b/src/models/DB.php @@ -33,6 +33,13 @@ class DB { $this->connection->exec("USE " . self::$dbname); } + /** + * @return string + */ + static function genFK(string $currentColumn, string $foreignTable, string $foreignColumn) { + return "CONSTRAINT fk_{$currentColumn}_{$foreignTable} FOREIGN KEY ({$currentColumn}) REFERENCES {$foreignTable}($foreignColumn)"; + } + /* Create */ /** @@ -43,16 +50,28 @@ class DB { * Represents the column information. Each value must be like: "column_name data_type", where the data_type should be taken * from the constant values of DB class. * Example value: array("first_name " . DB::STRING_TYPE, "age " . DB::INTEGER_TYPE, "income " . DB::FLOAT_TYPE) + * + * @param string[] $foreignKeys - OPTIONAL + * Represents the foreign keys. All foreign keys **MUST** be generated the the static DB method genFK. + * Example value: array(DB::genFK("jobId", "jobs", "id"), DB::genFK("cityId", "cities", "id")) */ - function createTable(string $tableName, array $columns) { + function createTable(string $tableName, array $columns, array $foreignKeys = null) { $query = "CREATE TABLE IF NOT EXISTS {$tableName}( - id INT NOT NULL AUTO_INCREMENT,"; + id INT NOT NULL AUTO_INCREMENT, "; foreach ($columns as $column) { - $query .= "{$column},"; + $query .= "{$column}, "; } - $query .= "PRIMARY KEY (id));"; + $query .= "PRIMARY KEY (id), "; + + foreach ($foreignKeys as $fk) { + $query .= "{$fk}, "; + } + + $query = rtrim($query, ", "); + $query .= ");"; + echo $query; try { $this->connection->exec($query); -- cgit v1.3.1-23-gd82d From 0aa067b783ec3ba374380b82612eb876634c78f8 Mon Sep 17 00:00:00 2001 From: Syndamia Date: Thu, 1 Apr 2021 13:27:08 +0300 Subject: Made index.php a router and added the basis of landing view and controller --- src/controllers/LandingController.php | 9 +++++++++ src/index.php | 28 +++++++++++++++++++--------- src/models/DB.php | 1 - src/views/landing.php | 7 +++++++ 4 files changed, 35 insertions(+), 10 deletions(-) create mode 100644 src/controllers/LandingController.php create mode 100644 src/views/landing.php (limited to 'src/models/DB.php') diff --git a/src/controllers/LandingController.php b/src/controllers/LandingController.php new file mode 100644 index 0000000..80e0b5b --- /dev/null +++ b/src/controllers/LandingController.php @@ -0,0 +1,9 @@ + -

Hello World!

$obj) { - echo "{$obj->id} {$obj->title}
"; - } - echo "
"; +include_once("controllers/LandingController.php"); + +/* The landing page practically acts as our page router + * Thanks https://www.taniarascia.com/the-simplest-php-router/ + */ + +$landingController = new LandingController(); + +$request = $_SERVER['REQUEST_URI']; + +switch ($request) { + case "": + case "/": + $landingController->invoke(); + break; + default: + http_response_code(404); + break; +} ?> diff --git a/src/models/DB.php b/src/models/DB.php index 9fd705c..8174831 100644 --- a/src/models/DB.php +++ b/src/models/DB.php @@ -71,7 +71,6 @@ class DB { $query = rtrim($query, ", "); $query .= ");"; - echo $query; try { $this->connection->exec($query); diff --git a/src/views/landing.php b/src/views/landing.php new file mode 100644 index 0000000..06e32a5 --- /dev/null +++ b/src/views/landing.php @@ -0,0 +1,7 @@ +

Landing page!

+ +id} {$job->title}
"; + } +?> -- cgit v1.3.1-23-gd82d