【问题标题】:Call to undefined method codeigniter Modeloproduccion::obtener_produccion_por_id()调用未定义的方法 codeigniter Modeloproduccion::obtener_produccion_por_id()
【发布时间】:2019-09-12 17:28:39
【问题描述】:
UPDATE: ITS WORKING NOW, A ERROR IN MY MODAL. SORRY.

我的控制器或模型有点问题,我不知道,但我需要你的帮助。我遇到了错误

调用未定义的方法 Modeloproduccion::obtener_produccion_por_id()

这是我的控制器Produccion.php

 function actualizar()
{
    $this->load->helper('form');
    $data['main_title'] = 'Proyectos';
    $data['title2'] = 'Ver/Editar Proyecto';
    // Obtenemos el id de la editorial a editar
    $id = $this->input->post('id');
    $resultado = $this->modeloproduccion->obtener_produccion_por_id($id);

这是我的模型Modeloproduccion.php

 function obtener_produccion_por_id($id)
    {
        $this->db->where('id', $id);
        $query = $this->db->get('produccion');
        return $query->result_array();
    }

有什么想法吗?

非常感谢!

【问题讨论】:

    标签: php function model controller codeigniter-3


    【解决方案1】:

    $this->load->model('Modeloproduccion');

    【讨论】:

      【解决方案2】:

      你加载模型了吗? 为此,您必须添加

      $this->load->model('modeloproduccion');
      

      在使用模型之前。

      编辑:根据Codeigniter3的documentation,大小写没有问题。

      【讨论】:

      • 是的,我有 load->helper('form'); $this->load->library('form_validation'); $this->load->model('modeloproduccion');
      • @Pixysve 我可以看看你的完整模型吗?
      猜你喜欢
      • 1970-01-01
      • 2011-07-13
      • 2020-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-06-09
      • 2021-11-25
      相关资源
      最近更新 更多