为什么在视图页面中会出现这样的错误

时间:2014-02-11 10:38:24

标签: codeigniter

CI_DB_mysql_result Object([conn_id] => Resource id #28[result_id] => Resource id #33[result_array] => Array ()[result_object] => Array()[custom_result_object] => Array()
[current_row] => 0 [num_rows] => 1[row_data] =>)

这是我的模型页面

public function getProductsListByCategory1($limit, $start) 
            {                           
                        $this->db->limit($limit, $start);
                        $this->db->select('image_path,tagline,category_id,product_id');
                        $this->db->where('category_id','1');
                        $query = $this->db->get("tb1_bl_products order by tagline");
                        if ($query->num_rows() > 0) 
                        {
                            foreach ($query->result() as $row) 
                            {
                                $data[] = $row;
                            }
                        return $data;
                        }
                        else
                        {
                            return array();     
                        }
            }

1 个答案:

答案 0 :(得分:0)

使用$query->result_array()而不是$query->result()