Using MySQL triggers to update customers balance
问题 I need some help in understanding triggers and how they work. I have 3 tables: Customers Id | Balance Invoices Id | Custid | Amount Payments Id | CustId | Amount I have an insert statement to insert the invoices: $this->db->insert('invoices', array( 'CustomerId' => $data['customerId'], 'Description' => $data['Description'], 'DateCreated' => $data['DateCreated'], 'Amount' => $data['Amount'] )); and need to update the customers balance after the insert. Similarly, after inserting or creating a