Get options from mySQL Query
3 posts by 2 authors in: Forums > CMS Builder
Last Post: November 11, 2013 (RSS)
By Toledoh - November 6, 2013
Hi Guys,
In a section, I want to be able to select options from another table, but only show certain options, so I guess I need to do something with the mySQL query?
I have a section "panels" and a field within that of "gallery" which is a checkbox.
In another section "pages" i want to be able to select items from "panels" that have the "gallery" checkbox ticked.
Any thoughts?
Cheers,
Tim (toledoh.com.au)
By ht1080z - November 11, 2013
Hi Tim,
You need to create a 'list' type field in your "pages" section with List option "Get options from MYSQL query (advanced) and paste something like:
SELECT num, title
FROM `<?php echo $TABLE_PREFIX ?>panels`
WHERE gallery = 1
ORDER BY title ASC
You can use "Display as" options: pulldown or pulldown (multi value) only.
In this query i also sort the titles alphabetically.
I hope this helps,
Karls