scc24php/faculty/index.php

46 lines
2.2 KiB
PHP

<?php
require('../.hta_config/env.php');
require('../.hta_header.php');
$noticeHead = 'Tender Notice';
// $departments = array("History","Pol science","Library","Geography","Geography","Zoology","Math","Library","Sanskrit","Math","Geography");
// var_dump($departments);
?>
<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: center;">Sl No.</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: center;">Faculty Name</th>
<th style="border: 1px solid #6b6245; padding: 8px; text-align: center;">Department</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;"><a href="/faculty/'.$notice['slug'].'.html">' . htmlspecialchars($notice['title']) . '</a></td>
<td style="border: 1px solid #6b6245; padding: 8px; text-align: center;"></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');
?>