Codeigniter Message: Undefined property: stdClass

后端 未结 1 581
借酒劲吻你
借酒劲吻你 2020-12-21 20:02

I\'m trying to query the db with the following query in the model:

function showSpecific(){

    $all = $this->session->all_userdata();
    $name = $al         


        
相关标签:
1条回答
  • 2020-12-21 20:36

    I think

    $data['query'] = $this->db->query("...");
    

    should be

    $query=$this->db->query("...");
    

    so you can

    foreach ($query->result() as $row) {...}
    

    reference: codeigniter

    After question Update : You have $query variable inside your view because of $data['query'] ($data will be extracted), $query is your object now (inside your view) so you can loop the $query.

    Wrong model name getMessages() has been called, it should be showSpecific()

    0 讨论(0)
提交回复
热议问题