Added function to deactivate post
This commit is contained in:
@@ -37,11 +37,16 @@ class Post extends \Core\Model
|
||||
try {
|
||||
$db = static::connectDB();
|
||||
|
||||
$sql = "SELECT * FROM pengumuman ORDER BY created_at";
|
||||
$sql = "SELECT * FROM pengumuman WHERE status = ? ORDER BY created_at";
|
||||
|
||||
if ($stmt = $db->query($sql)) {
|
||||
$result = $stmt->fetchAll(\PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
$query = $db->prepare($sql);
|
||||
$query->bindValue(1, 1);
|
||||
|
||||
if ($query->execute()) {
|
||||
if ($query->rowCount() != 0) {
|
||||
$result = $query->fetchAll(\PDO::FETCH_ASSOC);
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo $e->getMessage();
|
||||
|
||||
Reference in New Issue
Block a user