Я хочу построить массив со всеми доступными записями. < /p>
fields_model: < /p>
Код: Выделить всё
public function getFields() {
$this->db->select('*')->from('fields');
$query = $this->db->get();
if (!$query->num_rows() > 0) {
die("Error");
}
$fields = array();
foreach ($query->result() as $row) {
$fields[$row->id]['nume'] = $row->field_name;
$fields[$row->id]['label'] = $row->field_label;
}
// Pass the result back to the controller
return $fields;
}
< /code>
В моем контроллере у меня есть: < /p>
$this->load->model('fields_model');
$data['fields'] = $this->fields_model->getFields();
Подробнее здесь: https://stackoverflow.com/questions/326 ... conversion
Мобильная версия