Summary Files Commits Branches @commit @diff @stats
path: root / src / models / DB.php
diff options
context:
space:
mode:
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();