Deeplogica
New Member
Hi
I am trying to load a dropdown list with data from a table using the following code
$options = JHTML::_('select.option', '0', 'Please select' );
$db = JFactory::getDbo();
$db->setQuery("SELECT ID, project_name, assessment_number FROM projects");
$rows = $db -> loadObjectList();
foreach ($rows as $row) {
$options = JHTML::_('select.option',(string) $row->ID, $row->project_name .' ' .$row->assessment_number);
}
return $options;
But I get the error stating
**Invalid suboptions specified for element 'project': stdClass::__set_state(array( 'value' => '2', 'text' => 'Walmart_Project1 2', 'disable' => false, ))**
Can anyone help please? I dont know what could be causing this
thanks
I am trying to load a dropdown list with data from a table using the following code
$options = JHTML::_('select.option', '0', 'Please select' );
$db = JFactory::getDbo();
$db->setQuery("SELECT ID, project_name, assessment_number FROM projects");
$rows = $db -> loadObjectList();
foreach ($rows as $row) {
$options = JHTML::_('select.option',(string) $row->ID, $row->project_name .' ' .$row->assessment_number);
}
return $options;
But I get the error stating
**Invalid suboptions specified for element 'project': stdClass::__set_state(array( 'value' => '2', 'text' => 'Walmart_Project1 2', 'disable' => false, ))**
Can anyone help please? I dont know what could be causing this
thanks