Level 67
The only way you could is if your cart table contained those fields.
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
This is my trigger code to log changes when quantity has been made changes.
CREATE TRIGGER `qty_chgs` AFTER UPDATE ON `cart`
FOR EACH ROW BEGIN
IF NEW.QUANTITY != OLD.QUANTITY THEN
INSERT INTO logs (`action`,`product_id`,`created_at`,`updated_at`) VALUES (1,NEW.PRODUCT_ID,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP);
END IF;
END
I have a table named 'users'. When the quantity amount in 'cart' table being modified, j want to log the user id and also the product id. How can i track which user modified it?
Please or to participate in this conversation.