Inventory saving [MySQL]
#7

Quote:
Originally Posted by GospodinX
Посмотреть сообщение
It's great.Is there anything for example that amount can't be 0?(if it's 0 delete row).I just need it now.
The only thing similar to this is triggers: https://dev.mysql.com/doc/refman/8.0...er-syntax.html
I never used them with INSERT .. ON DUPLICATE so I am not sure. An example:
pawn Код:
CREATE TRIGGER remove_item BEFORE INSERT ON inventory
  FOR EACH ROW
    DELETE FROM inventory WHERE amount = 0;
However, I find this method way not appropriate. You do know the amount of item before executing query so you can delete when it is 0 and insert/update when it is not.
Reply


Messages In This Thread
Inventory saving [MySQL] - by GospodinX - 03.08.2018, 08:50
Re: Inventory saving [MySQL] - by GRiMMREAPER - 03.08.2018, 09:29
Re: Inventory saving [MySQL] - by GospodinX - 03.08.2018, 09:39
Re: Inventory saving [MySQL] - by GRiMMREAPER - 03.08.2018, 09:53
Re: Inventory saving [MySQL] - by Calisthenics - 03.08.2018, 13:10
Re: Inventory saving [MySQL] - by GospodinX - 03.08.2018, 14:47
Re: Inventory saving [MySQL] - by Calisthenics - 03.08.2018, 20:26

Forum Jump:


Users browsing this thread: 1 Guest(s)