【问题标题】:Call to a member function getResultArray() on bool codeigniter 4在 bool codeigniter 4 上调用成员函数 getResultArray()
【发布时间】:2021-11-18 21:06:32
【问题描述】:

我遇到了这个错误 在 bool 上调用成员函数 getResultArray()

在我的电脑上运行得很好,但在我的主机上我有这个错误

我能做什么?请帮帮我

'public function obt_lista_prestamos($activo)
{    
$db = \Config\Database::connect();
$db = db_connect();
$builder = $db->table('t_prestamo');
$builder->select('*');
$builder->join('t_clientes', 't_prestamo.fk_idcliente = t_clientes.id_cliente');
$query = $builder->get();    
$query = $query->getResultArray();    
return ($query);
}'

【问题讨论】:

    标签: codeigniter


    【解决方案1】:

    你的代码看起来不错,但你可以试试这个:

    'public function obt_lista_prestamos($activo)
     {    
     $db = \Config\Database::connect();
     $db = db_connect();
     $builder = $db->table('t_prestamo');
     $builder->select('*');
     $builder->join('t_clientes', 't_prestamo.fk_idcliente =                
     t_clientes.id_cliente');
     $query = $builder->get()->getResultArray();    
     return ($query);
    }'
    

    我遇到了同样的问题,这对我有用。 注意这一行: $query = $builder->get()->getResultArray();

    【讨论】:

      猜你喜欢
      • 2021-12-22
      • 1970-01-01
      • 2021-01-23
      • 2019-12-29
      • 1970-01-01
      • 2020-09-30
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多