使用此网站上显示的“多选字段”功能没有问题:
http://www.grocerycrud.com/documentation/options_functions/field_type
$crud->field_type('fruits','multiselect',
array( "1" => "banana", "2" => "orange", "3" => "apple"));
下一步,我尝试从数据库中提取数据以替换上述公式中的“数组”,但失败了,请告知。
$this->db->select('employeeNumber');
$a = $this->db->get('employees')->result();
$crud->field_type('firstName', 'multiselect', $a);
我得到的结果像
Array ( [0] => stdClass Object ( [employeeNumber] => 1002 )
[1] => stdClass Object ( [employeeNumber] => 1056 )
嗯...如何使它变成这种格式,有什么建议吗?:
array( "1" => "banana", "2" => "orange", "3" => "apple")