%PDF- %GIF98; %PNG;
Server : ApacheSystem : Linux sh00666.bluehost.com 5.14.0-687.26.1.el9_8.x86_64 #1 SMP PREEMPT_DYNAMIC Tue Jul 14 16:32:02 EDT 2026 x86_64 User : ndkhermy ( 1200) PHP Version : 8.5.12 Disable Function : NONE Directory : /home1/ndkhermy/public_html/website_6ca89795/admin/ |
Upload File : |
<?php
session_start();
if (!isset($_SESSION["username"])) {
header('location:../admin.php');
exit();
}
include('header.php');
include('../dbcon.php');
?>
<div class="container">
<h2>Solution</h2>
<h2 align="right">
<a class="btn btn-success" href="solutions.php">Add Solution</a>
</h2>
<table class="table table-bordered table-striped">
<thead>
<tr>
<th>No.</th>
<th>Title</th>
<th>Sub Menu</th>
<th>Page Title</th>
<th>Description</th>
<th>Keywords</th>
<th>Robots</th>
<th>Canonical</th>
<th>Content</th>
<th>Insurance Policy</th>
<th>Insurance Tabs</th>
<th>About Image</th>
<th>Service Entry Images</th>
<th>Features Content</th>
<th>Features List</th>
<th>FAQs</th>
<th>Actions</th>
</tr>
</thead>
<tbody>
<?php
// Query to get all solutions
$query = "SELECT * FROM `solution`";
$result = $conn->query($query);
if ($result->num_rows > 0) {
$count = 0;
while ($row = $result->fetch_assoc()) {
$count++;
$service_id = $row['id']; // solution id
// Function to fetch data and store in array based on service_content_id
function fetchData($conn, $table, $service_id) {
$query = "SELECT * FROM $table WHERE service_content_id = ?";
$stmt = $conn->prepare($query);
$stmt->bind_param("i", $service_id);
$stmt->execute();
return $stmt->get_result();
}
// Fetch related data from other tables
$insuranceTabs = fetchData($conn, 'insurence_tab', $service_id);
$serviceImages = fetchData($conn, 'service_entry_images', $service_id);
$featuresList = fetchData($conn, 'service_features', $service_id);
$faqs = fetchData($conn, 'service_faqs', $service_id);
// Debugging: Check the fetched data
// echo "<pre>"; var_dump($insuranceTabs->fetch_all()); echo "</pre>";
?>
<tr>
<td><?php echo $count; ?></td>
<td><?php echo htmlspecialchars($row['title']); ?></td>
<td><?php echo htmlspecialchars($row['submenu']); ?></td>
<td><?php echo htmlspecialchars($row['page_title']); ?></td>
<td><?php echo htmlspecialchars($row['description']); ?></td>
<td><?php echo htmlspecialchars($row['keywords']); ?></td>
<td><?php echo htmlspecialchars($row['robots']); ?></td>
<td><?php echo htmlspecialchars($row['canonical']); ?></td>
<td><?php echo htmlspecialchars($row['subtitle1']); ?></td>
<td><?php echo htmlspecialchars($row['insurence']); ?></td>
<td>
<?php
// Display Insurance Tabs
if ($insuranceTabs->num_rows > 0) {
while ($tab = $insuranceTabs->fetch_assoc()) {
echo "<strong>Q:</strong> " . htmlspecialchars($tab['question']) . "<br>";
echo "<strong>A:</strong> " . htmlspecialchars($tab['answer']) . "<br><br>";
}
} else {
echo "No Insurance Tabs.";
}
?>
</td>
<td>
<img src="dataimg/<?php echo htmlspecialchars($row['aboutimage']); ?>"
style="max-height:150px; max-width:200px;" alt="About Image">
</td>
<td>
<?php
// Display Service Entry Images
if ($serviceImages->num_rows > 0) {
while ($img = $serviceImages->fetch_assoc()) {
echo '<img src="dataimg/' . htmlspecialchars($img['image']) . '" style="max-height:100px; max-width:100px;" alt="Service Image"><br>';
if (!empty($img['text'])) {
echo "<em>" . htmlspecialchars($img['text']) . "</em><br>";
}
}
} else {
echo "No Service Images.";
}
?>
</td>
<td><?php echo htmlspecialchars($row['features']); ?></td>
<td>
<?php
// Display Features List
if ($featuresList->num_rows > 0) {
while ($feature = $featuresList->fetch_assoc()) {
echo '<img src="dataimg/' . htmlspecialchars($feature['image']) . '" style="max-height:100px; max-width:100px;" alt="Feature Image"><br>';
echo htmlspecialchars($feature['text']) . "<br>";
}
} else {
echo "No Features List.";
}
?>
</td>
<td>
<?php
// Display FAQs
if ($faqs->num_rows > 0) {
while ($faq = $faqs->fetch_assoc()) {
echo "<strong>Q:</strong> " . htmlspecialchars($faq['question']) . "<br>";
echo "<strong>A:</strong> " . htmlspecialchars($faq['answer']) . "<br><br>";
}
} else {
echo "No FAQs.";
}
?>
</td>
<td>
<a class="btn btn-primary" href="solutionsform.php?sid=<?php echo $row['id']; ?>">Edit</a>
<a class="btn btn-danger" href="solutionsdelete.php?sid=<?php echo $row['id']; ?>"
onclick="return confirm('Are you sure you want to delete this?');">Delete</a>
</td>
</tr>
<?php
}
} else {
echo "<tr><td colspan='17' class='text-center'>No data found.</td></tr>";
}
?>
</tbody>
</table>
</div>
<!-- / Content -->
<div class="content-backdrop fade"></div>
</div>
<!-- Content wrapper -->
</div>
<!-- / Layout page -->
</div>
</div>
<!-- / Layout wrapper -->
<!-- Core JS -->
<!-- build:js assets/vendor/js/core.js -->
<script src="../assets/vendor/libs/jquery/jquery.js"></script>
<script src="../assets/vendor/libs/popper/popper.js"></script>
<script src="../assets/vendor/js/bootstrap.js"></script>
<script src="../assets/vendor/libs/perfect-scrollbar/perfect-scrollbar.js"></script>
<script src="../assets/vendor/js/menu.js"></script>
<!-- endbuild -->
<!-- Vendors JS -->
<!-- Main JS -->
<script src="../assets/js/main.js"></script>
<!-- Page JS -->
<!-- Place this tag in your head or just before your close body tag. -->
<script async defer src="https://buttons.github.io/buttons.js"></script>
</body>
</html>