From 8b6c909d95c3d72ec5c567e6d7f52e92f0c96a6f Mon Sep 17 00:00:00 2001 From: Andrew Malsbury Date: Mon, 9 Oct 2023 20:26:03 +0000 Subject: [PATCH] Switched to DB controlled Account Types --- accounts.php | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/accounts.php b/accounts.php index 909916a4..cfd3c244 100644 --- a/accounts.php +++ b/accounts.php @@ -58,7 +58,10 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); $opening_balance = floatval($row['opening_balance']); $account_currency_code = nullable_htmlentities($row['account_currency_code']); $account_notes = nullable_htmlentities($row['account_notes']); - $account_type = intval($row['account_type']); + $account_type_id = intval($row['account_type']); + + //Find account type name + $account_type = mysqli_query($mysqli, "SELECT * FROM account_types WHERE account_type_id = $account_type_id"); $sql_payments = mysqli_query($mysqli, "SELECT SUM(payment_amount) AS total_payments FROM payments WHERE payment_account_id = $account_id"); $row = mysqli_fetch_array($sql_payments); @@ -77,34 +80,7 @@ $num_rows = mysqli_fetch_row(mysqli_query($mysqli, "SELECT FOUND_ROWS()")); - - +