Customer List

setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); // Fetch customer data $stmt = $db->prepare("SELECT * FROM customers ORDER BY regDate DESC"); $stmt->execute(); $content = $stmt->fetchAll(PDO::FETCH_ASSOC); // Fetch invoice data $stmt2 = $db->prepare("SELECT * FROM invoice"); $stmt2->execute(); $invoiceContent = $stmt2->fetchAll(PDO::FETCH_ASSOC); // Loop through each customer $customerSerial = 1; foreach ($content as $customer) { // Find all invoices for the current customer $matchingInvoices = array_filter($invoiceContent, function ($invoice) use ($customer) { return $invoice['customerId'] === $customer['customerId']; }); // If there are matching invoices, loop through them if (!empty($matchingInvoices)) { foreach ($matchingInvoices as $invoice) { ?> '; } ?>
Sl No Name Payment Start Date Payment End Date Number of Installments Monthly Payment Date Monthly Payment Amount Totoal Amount Action
$ $ New Invoice Edit Invoice Payment
No invoice available Create Invoice Additional Payment
Error: ' . $e->getMessage() . '