How to use fields in MySQL query

  • Posts: 13
  • Thank you received: 2
  • Hikashop Essential
3 years 9 months ago #328954

I want to run a mysql query as a mass action, the trigger is after order update. I tried to use the fields of the current order but no success.
For example this is an SQL:

insert into amim_test (test_text) values(order_id)
or
insert into amim_test (test_text) values(product_id)

result is and error: Unknown column 'order_id' in 'field list'.

How can I use the values from the result of the trigger?
I want to save some data from the order into a table. The examples are test SQLs only.

I need at least the userid of the customer, but prefer to learn how to use all available fields.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
3 years 9 months ago #328956

Hi,

You need to use {} around the column names.
In an "order" mass action, you'll be able to use all the columns of the order table: {order_id} {order_user_id} etc

Please Log in or Create an account to join the conversation.

  • Posts: 13
  • Thank you received: 2
  • Hikashop Essential
3 years 9 months ago #328993

Oh fine, it works! Thank you for your kind help!

The following user(s) said Thank You: Philip

Please Log in or Create an account to join the conversation.

Time to create page: 0.057 seconds
Powered by Kunena Forum