<?php if(!defined('FastCore')){exit('Opss!');}
?>
<?PHP
if(isset($_POST["del"])){
$del_message = intval($_POST["del"]);
$db->Query("DELETE FROM db_message WHERE id = '$del_message'");
echo "<center><b>Новость удалена</b></center><BR />";
}
?>
<style>
table tr td {padding: 5px !important; vertical-align: middle !important;}
</style>
<table class="table table-hover text-center table-bordered bg-white">
<thead class="bg-light">
<th width="50">ID</td>
<th>ID </td>
<th>Заглавие</td>
<th>Текст рассылки</td>
<th>Дата добавления</td>
<th width="70">Действие</td>
</thead>
<tbody>
<?php
$rows = $db->query("SELECT * FROM `db_message` WHERE `id` > 0")->numRows();
if($rows == 0) {
echo '<tr><td colspan="3"><div class="alert alert-danger">Рассылки нет</div></td></tr>';
}
else {
$data = $db->query("SELECT * FROM `db_message` ORDER BY `id` DESC LIMIT 50")->fetchAll();
foreach ($data as $data) {
?>
<tr>
<td width="50"><?=$data["id"]; ?></td>
<td><b> <?=$data['id']; ?></b></td>
<td><b> <?=$data['title']; ?></b></td>
<td><b> <?=$data['description']; ?></b></td>
<td><b> <?=date("d/m/Y в H:i",$data['date_add']); ?></b></td>
<td width="70">
<form action="" method="post" class="m-0 p-0">
<input type="hidden" name="del" value="<?=$data['id']; ?>" />
<input type="submit" value="Удалить" class="btn btn-danger btn-sm"/>
</form>
</td>
</tr>
<?php
}
}
?>
</tbody>
</table>