Extract some database values inside a custom field
In order to display information from your database in a custom field defined for one of your departments you will need a custom script (within code tags) in the Values property of the field, for example:
-
Using a textbox:
//<code> $db = Joomla\CMS\Factory::getDBO(); $db->setQuery("SELECT your_value FROM your_table"); $result = $db->loadResult(); return $result; //</code>
-
Using a dropdown:
//<code> $db = Joomla\CMS\Factory::getDBO(); $db->setQuery("SELECT your_value FROM your_table"); $results = $db->loadObjectList(); $items[] = "Please Select"; foreach ($results as $res){ $items[] = $res->your_value; } return implode("\n",$items); //</code>
8 persons found this article helpful.
You Should Also Read
Knowledgebase template overwrite |
Hiding the Priority field in the ticket submission form |