Skip to content

Commit b8e2a6b

Browse files
Refactor SQL query in profile-customer.php
1 parent 834b73c commit b8e2a6b

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

profile-customer.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
header('Location: customers.php?type=error&message=Customer not found!');
66
}
77
$customer_id = $_GET['id'];
8-
$sql = 'SELECT Transactions.id, Transactions.kilo, Transactions.total, Transactions.status, Transactions.created_at, users.username, customers.fullname
9-
FROM Transactions
10-
JOIN users ON Transactions.user_id = users.id
11-
JOIN customers ON Transactions.customer_id = customers.id
8+
$sql = 'SELECT l.id, l.kilo, t.total, l.status, l.created_at, users.username, customers.fullname
9+
FROM laundry AS l
10+
JOIN transactions AS t ON l.transaction_id = t.id
11+
JOIN users ON t.user_id = users.id
12+
JOIN customers ON t.customer_id = customers.id
1213
WHERE customer_id = :id';
1314
$stmt = $db->prepare($sql);
1415
$stmt->bindParam(':id', $customer_id);

0 commit comments

Comments
 (0)