$db->setQuery("SELECT 'Field1` FROM `XXXX_comprofiler` WHERE `user_id`='".$userId."'");
//<code>
// Prepare the empty array
$items = array();
// Prepare the database connection
$db = JFactory::getDbo();
// Keep this if you'd like a "Please select" option, otherwise comment or remove it
$items[] = "|Please Select[c]";
// Run the SQL query and store it in $results
$db->setQuery("SELECT your_value, your_label FROM #__your_table");
$results = $db->loadObjectList();
// Now, we need to convert the results into a readable RSForm! Pro format.
// The Items field will accept values in this format:
// value-to-be-stored|value-to-be-shown
// Eg. m|M-sized T-shirt
foreach ($results as $result) {
$value = $result->your_value;
$label = $result->your_label;
$items[] = $value.'|'.$label;
}
// Multiple values are separated by new lines, so we need to do this now
$items = implode("\n", $items);
// Now we need to return the value to the field
return $items;
//</code>
Please Log in to join the conversation.
SELECT `fieldtitle` AS `value`, if ( `fieldlabel` != '', `fieldlabel`, `fieldtitle` ) AS `text`, `fieldgroup` AS `group`
FROM `#__comprofiler_field_values`
WHERE `fieldid` = FIELD_ID_HERE
ORDER BY `ordering`
SELECT `your_value`, `your_label` FROM `#__your_table`
Please Log in to join the conversation.