I have a record i'm collecting from a form. When this form is submitted, i am to update certain column using a trigger. This column are not to be supplied by the user. I have used before insert trigger like it was suggested in my search and i still get same error. Here is my trigger.
DELIMITER $$
CREATE TRIGGER `computeDetails` BEFORE INSERT ON `tbl_asset` FOR EACH ROW
BEGIN
DECLARE Price decimal;
DECLARE numberOfUnits bigint;
DECLARE total_purchase_price decimal;
SET Price = NEW.purchased_Price;
Set numberOfUnits = NEW.numberof_units;
Set totalprice = (Price * numberOfUnits);
set current_total_price = (totalprice * numberOfUnits);
Update tbl_asset set NEW.totalprice = totalprice, NEW.current_total_price
= current_total_price where id = NEW.id;
END