[Skip to main content](#vessel-content)

#   How to use fields in MySQL query

##

- **[danidek](/forum/user/47455-danidek "View danidek's Profile")**
- [![danidek's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/47455-danidek "View danidek's Profile") Topic Author
- [ Offline](/forum/user/47455-danidek)

Less More

- Posts: 13
- Thank you received: 2
-
-

5 years 9 months ago [\#328954](#328954) by [danidek](/forum/user/47455-danidek "View danidek's Profile")  *[How to use fields in MySQL query](/forum/44-mass-actions/901798-how-to-use-fields-in-mysql-query#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&#95;test (test&#95;text) values(order&#95;id) or insert into amim&#95;test (test&#95;text) values(product&#95;id)  result is and error: Unknown column 'order&#95;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.")* was created by *[danidek](/forum/user/47455-danidek "View danidek's Profile")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDE3OTgtaG93LXRvLXVzZS1maWVsZHMtaW4tbXlzcWwtcXVlcnk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[nicolas](/forum/user/63-nicolas "View nicolas's Profile")**
- [![nicolas's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar63.png?1793428657)](/forum/user/63-nicolas "View nicolas's Profile")
- [ Away](/forum/user/63-nicolas)

Less More

- Posts: 86587
- Thank you received: 14325
-
-

5 years 9 months ago [\#328956](#328956) by [nicolas](/forum/user/63-nicolas "View nicolas's Profile")  Replied by *[nicolas](/forum/user/63-nicolas "View nicolas's Profile")* on topic *[How to use fields in MySQL query](/forum/44-mass-actions/901798-how-to-use-fields-in-mysql-query#328956 "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&#95;test (test&#95;text) values(order&#95;id) or insert into amim&#95;test (test&#95;text) values(product&#95;id)  result is and error: Unknown column 'order&#95;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.")*

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](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDE3OTgtaG93LXRvLXVzZS1maWVsZHMtaW4tbXlzcWwtcXVlcnk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

- **[danidek](/forum/user/47455-danidek "View danidek's Profile")**
- [![danidek's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/47455-danidek "View danidek's Profile") Topic Author
- [ Offline](/forum/user/47455-danidek)

Less More

- Posts: 13
- Thank you received: 2
-
-

5 years 9 months ago [\#328993](#328993) by [danidek](/forum/user/47455-danidek "View danidek's Profile")  Replied by *[danidek](/forum/user/47455-danidek "View danidek's Profile")* on topic *[How to use fields in MySQL query](/forum/44-mass-actions/901798-how-to-use-fields-in-mysql-query#328993 "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&#95;test (test&#95;text) values(order&#95;id) or insert into amim&#95;test (test&#95;text) values(product&#95;id)  result is and error: Unknown column 'order&#95;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.")*

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

The following user(s) said Thank You: [Philip](/forum/user/34318-philip "View Philip's Profile")

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzQ0LW1hc3MtYWN0aW9ucy85MDE3OTgtaG93LXRvLXVzZS1maWVsZHMtaW4tbXlzcWwtcXVlcnk/dG1wbD1tYXJrZG93bg==) or [Create an account](/component/users/registration?Itemid=101) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.061 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
