first commit
This commit is contained in:
49
customers/.hta_slug/list.php
Normal file
49
customers/.hta_slug/list.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
require('../.hta_config/conf.php');
|
||||
?>
|
||||
<div class="container mt-4">
|
||||
<h2 class="mb-3 text-center">Customer List</h2>
|
||||
<div class="table-responsive">
|
||||
<table class="table table-bordered table-striped table-hover">
|
||||
<thead class="thead-dark">
|
||||
<tr>
|
||||
<th>Sl No</th>
|
||||
<th>Name</th>
|
||||
<th>Mobile</th>
|
||||
<th>Email</th>
|
||||
<th>Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
try {
|
||||
$db = new PDO("mysql:host=$mariaServer;dbname=$mariaDb", $mariaUser, $mariaPass);
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
$stmt = $db->prepare("SELECT * FROM customers ORDER BY regDate DESC");
|
||||
$stmt->execute();
|
||||
$content = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
$customerSerial = 1; // Moved outside loop
|
||||
foreach ($content as $customer) {
|
||||
?>
|
||||
<tr>
|
||||
<td><?php echo $customerSerial++; ?></td>
|
||||
<td><?php echo htmlspecialchars($customer['name']); ?></td>
|
||||
<td><?php echo htmlspecialchars($customer['mobile']); ?></td>
|
||||
<td><?php echo htmlspecialchars($customer['email']); ?></td>
|
||||
<td>
|
||||
<a href="/customers/edit/?customerId=<?php echo $customer['customerId']; ?>" class="btn btn-primary btn-sm">Edit</a>
|
||||
<a href="/customers/emi/?customerId=<?php echo $customer['customerId']; ?>" class="btn btn-primary btn-sm">Bill</a>
|
||||
<a href="/customers/billing-details/?customerId=<?php echo $customer['customerId']; ?>" class="btn btn-primary btn-sm">Billing Info</a>
|
||||
</td>
|
||||
</tr>
|
||||
<?php
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo '<tr><td colspan="5" class="text-danger text-center">Error: ' . $e->getMessage() . '</td></tr>';
|
||||
}
|
||||
?>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
Reference in New Issue
Block a user