Fix some codesmells

This commit is contained in:
Marcus Hill
2023-07-02 15:07:50 +01:00
parent ebecdd3da2
commit f6c4e72c86

View File

@@ -218,14 +218,14 @@ if (isset($_GET['delete_recurring'])) {
//Delete Items Associated with the Recurring //Delete Items Associated with the Recurring
$sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_id = $recurring_id"); $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_recurring_id = $recurring_id");
while($row = mysqli_fetch_array($sql)) {; while($row = mysqli_fetch_array($sql)) {
$item_id = intval($row['item_id']); $item_id = intval($row['item_id']);
mysqli_query($mysqli,"DELETE FROM invoice_items WHERE item_id = $item_id"); mysqli_query($mysqli,"DELETE FROM invoice_items WHERE item_id = $item_id");
} }
//Delete History Associated with the Invoice //Delete History Associated with the Invoice
$sql = mysqli_query($mysqli,"SELECT * FROM history WHERE history_recurring_id = $recurring_id"); $sql = mysqli_query($mysqli,"SELECT * FROM history WHERE history_recurring_id = $recurring_id");
while($row = mysqli_fetch_array($sql)) {; while($row = mysqli_fetch_array($sql)) {
$history_id = intval($row['history_id']); $history_id = intval($row['history_id']);
mysqli_query($mysqli,"DELETE FROM history WHERE history_id = $history_id"); mysqli_query($mysqli,"DELETE FROM history WHERE history_id = $history_id");
} }
@@ -360,21 +360,21 @@ if (isset($_GET['delete_invoice'])) {
//Delete Items Associated with the Invoice //Delete Items Associated with the Invoice
$sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id"); $sql = mysqli_query($mysqli,"SELECT * FROM invoice_items WHERE item_invoice_id = $invoice_id");
while($row = mysqli_fetch_array($sql)) {; while($row = mysqli_fetch_array($sql)) {
$item_id = intval($row['item_id']); $item_id = intval($row['item_id']);
mysqli_query($mysqli,"DELETE FROM invoice_items WHERE item_id = $item_id"); mysqli_query($mysqli,"DELETE FROM invoice_items WHERE item_id = $item_id");
} }
//Delete History Associated with the Invoice //Delete History Associated with the Invoice
$sql = mysqli_query($mysqli,"SELECT * FROM history WHERE history_invoice_id = $invoice_id"); $sql = mysqli_query($mysqli,"SELECT * FROM history WHERE history_invoice_id = $invoice_id");
while($row = mysqli_fetch_array($sql)) {; while($row = mysqli_fetch_array($sql)) {
$history_id = intval($row['history_id']); $history_id = intval($row['history_id']);
mysqli_query($mysqli,"DELETE FROM history WHERE history_id = $history_id"); mysqli_query($mysqli,"DELETE FROM history WHERE history_id = $history_id");
} }
//Delete Payments Associated with the Invoice //Delete Payments Associated with the Invoice
$sql = mysqli_query($mysqli,"SELECT * FROM payments WHERE payment_invoice_id = $invoice_id"); $sql = mysqli_query($mysqli,"SELECT * FROM payments WHERE payment_invoice_id = $invoice_id");
while($row = mysqli_fetch_array($sql)) {; while($row = mysqli_fetch_array($sql)) {
$payment_id = intval($row['payment_id']); $payment_id = intval($row['payment_id']);
mysqli_query($mysqli,"DELETE FROM payments WHERE payment_id = $payment_id"); mysqli_query($mysqli,"DELETE FROM payments WHERE payment_id = $payment_id");
} }