Hello
I have a multi-selection dropdown {peg_alert___ospf_area} where the user selects a value or multiple values.
I use the following code to grab the value - this works great. However, I am wanting to concat the output if the users selects more than one value.
DB Structure:
id, peg_site_id, ospg_area
ospf_area values may be 'OSPF Area 01, OSPF Area 02, etc.
Can someone please provide some ideas on how to do this? Do I need to do a %Like% or CONTAINS statement?
I have a multi-selection dropdown {peg_alert___ospf_area} where the user selects a value or multiple values.
I use the following code to grab the value - this works great. However, I am wanting to concat the output if the users selects more than one value.
DB Structure:
id, peg_site_id, ospg_area
ospf_area values may be 'OSPF Area 01, OSPF Area 02, etc.
Can someone please provide some ideas on how to do this? Do I need to do a %Like% or CONTAINS statement?
PHP:
$id = '{peg_alert___ospf_area}';
$db = JFactory::getDbo();
$query = $db->getQuery(true);
$query
->select(array('peg_site_id'))
->from('site_ospf')
->where('ospf_area = ' . $db->quote($id));
$db->setQuery($query);
$rows = $db->loadObjectList();
$list = array();
foreach ($rows as $row)
{
$list[] = "<li>" . $row->peg_site_id . "</li>";
}
return "<ol>" . implode($list) . "</ol>";