Initial commit: new project structure and scripts

This commit is contained in:
MosLaptop\Not.Reda
2025-08-29 11:14:49 +02:00
parent 69dd02eb91
commit 75c6cc2a74
14 changed files with 180 additions and 225 deletions

49
Model/ProjectModel.php Normal file
View File

@@ -0,0 +1,49 @@
<?php
namespace ppb\Model;
use ppb\Library\Msg;
class ProjectModel extends Database
{
public function readProject()
{
$pdo = $this->linkDB();
$sql = "SELECT * FROM users";
try {
$pdo->setAttribute(\PDO::ATTR_ERRMODE, \PDO::ERRMODE_EXCEPTION);
} catch (\PDOException $e) {
new Msg(true, null, $e);
}
$sth = $pdo->prepare($sql);
$sth->execute();
$result = $sth->fetchAll(\PDO::FETCH_ASSOC);
$sth->closeCursor();
$pdo = null;
// fetch all
return $result;
}
public function insertNewMediaType($data)
{
$pdo = $this->linkDB();
try {
// it should add an new type and it is Files
$sql = "INSERT INTO media_types (id, type)
VALUES (:id, :type)";
$sth = $pdo->prepare($sql);
$sth-> execute([
':id' => $this->createUUID(),
':type' => $data['Files']
]);
$pdo = null;
new Msg(false, "Medientyp erfolgreich eingefügt.");
} catch (\PDOException $e) {
new Msg(true, 'Fehler beim Einfügen des Medientyps', $e);
}
}
}