I have a Query Drop Down (Multi-select) field with the following query:
Code:
SELECT id, DATE_FORMAT(date, '%M %e') as formatted_date
FROM oq7ve_sportscoop_sport_date
WHERE sport = 1 AND year = 2019
It is working fine; however, I need to change it so that it gets the year value in the WHERE clause (i.e. 2019) from the component parameters of a custom component.
If I could run PHP here I would use something like this:
Use a CB Code Field to execute your code then substitute it into your query. CB Query Field can not run PHP. You could also use a Code Select and have it done entirely in PHP.
Kyle (Krileon) Community Builder Team Member Before posting on forums:
Read FAQ thoroughly
+
Read our Documentation
+
Search the forums CB links:
Documentation
-
Localization
-
CB Quickstart
-
CB Paid Subscriptions
-
Add-Ons
-
Forge
-- If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
-- If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please
send me a private message
with your thread and will reply when possible!
-- Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
-- My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.
Thanks!
The code field and then with the substitution worked.
I tried initially to use the Code Select field, but had problems trying to get the data returned in the array format that it needed (it just kept displaying only one record).
If I need to use that in the future (code select) I'll have to get back to you for more help.