Populating a select box from a query.
Populating a select box from a query.
aarontharker
Posts: 41Questions: 11Answers: 0
Ok I'm trying to populate a select box with data returned from a query but I can't seem to get the where clause syntax correct. I have search the forums and tried a multitude of different formats but none of them seem to work out the way I need, either I get no results or I get an unknown column '0' in where clause error.
Field::inst( 'hm_members.user_type' )
->options( function () use ( $db ) {
$user_types = $db->select(
'hm_user_types',
'*',
'hm_user_types.id_user_types > 7' );
$out = array();
while ( $row = $user_types->fetch() ) {
$out[] = array(
"value" => $row['id_user_types'],
"label" => $row['description']
);
}
return $out;
} )
->validator( 'Validate::notEmpty' )
This is the code I'm using can someone please tell me where I am going wrong?
This discussion has been closed.