scc24php/faculty/index.php

47 lines
2.1 KiB
PHP

<?php
require('../.hta_config/env.php');
require('../.hta_header.php');
$noticeHead = 'Tender Notice';
?>
<div class="container">
<h2 style="text-align: center; margin: 20px 0px;">Faculty List</h2>
<table style="border-collapse: collapse; width: 100%; ">
<thead>
<tr>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Sl No.</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Faculty Name</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: left;">Action</th>
</tr>
</thead>
<tbody>
<?php
try {
$conn = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
$stmt = $conn->prepare("SELECT * FROM `scc24` WHERE `type` = 'faculty' ORDER BY (`date_created` = CURDATE()) DESC, `date_created` DESC");
$stmt->execute();
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
$serialNumber = 1;
foreach ($content as $notice) {
echo '<tr>
<td style="border: 1px solid #6b6245; padding: 8px;">' . $serialNumber . '</td>
<td style="border: 1px solid #6b6245; padding: 8px;">' . htmlspecialchars($notice['title']) . '</td>
<td style="border: 1px solid #6b6245; padding: 8px; text-align: center;">
<a href="/faculty/'.$notice['slug'].'.html">View</a>
<a href="#"></a>
</td>
</tr>';
$serialNumber++;
}
echo '';
} catch (PDOException $e) {
echo "<p class='text-danger'>Error: " . htmlspecialchars($e->getMessage()) . "</p>";
}
?>
</tbody>
</table>
</div>
<?php
require('../.hta_footer.php');
?>