Summary Files Commits Branches @commit @diff @stats
path: root / src / models / DB.php
diff options
context:
space:
mode:
Commitf9e2090a1028712ecc6e1b0c71390c821689b414 (patch)
Author
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-04-01 09:43:48 +0300
Committer
 Syndamia <kamen.d.mladenov@protonmail.com>
2021-04-01 09:43:48 +0300
Filesfed1608498f34299d7e3039cf3290c81e3e84875 /src/models/DB.php
devrix-job-board-f9e2090a1028712ecc6e1b0c71390c821689b414.tar
devrix-job-board-f9e2090a1028712ecc6e1b0c71390c821689b414.tar.gz
devrix-job-board-f9e2090a1028712ecc6e1b0c71390c821689b414.zip
Parente9ba7fbcff47f0e4a03d74b857e9864d67a8b163 (diff)
Implemented getById from DB and changed some method names
1 files changed, 7 insertions, 0 deletions
-rw-r--r--src/models/DB.php7
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();