You need to actually do a foreach here. In our case you need to do something like this:
$this->db->select('employeeNumber');
$results = $this->db->get('employees')->result();
$employees_multiselect = array();
foreach ($results as $result) {
$employees_multiselect[$result->employeeNumber] = $result->employeeNumber;
}
$crud->field_type('firstName', 'multiselect', $employees_multiselect);
or it is even better if you have the name of the employer to do something like this:
$this->db->select('employeeNumber, employeeName');
$results = $this->db->get('employees')->result();
$employees_multiselect = array();
foreach ($results as $result) {
$employees_multiselect[$result->employeeNumber] = $result->employeeName;
}
$crud->field_type('firstName', 'multiselect', $employees_multiselect);
0 comments:
Post a Comment