If my query to the table where I'm getting my options from returns nothing (which it should sometimes), I get one checkbox with no label. Anyway to get rid of it?
I'm using the code suggested in the checkbox element:
$db = JFactory::getDbo();
$db->setQuery('SELECT id, text FROM #__tablename');
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->id, $row->text);
}
return $options;
Works fine until the query returns nothing. Any assistance would be appreciated!
I'm using the code suggested in the checkbox element:
$db = JFactory::getDbo();
$db->setQuery('SELECT id, text FROM #__tablename');
$rows = $db->loadObjectList();
foreach ($rows as $row) {
$options[] = JHTML::_('select.option', $row->id, $row->text);
}
return $options;
Works fine until the query returns nothing. Any assistance would be appreciated!