codeigniter选择不工作

时间:2015-05-22 22:53:47

标签: php mysql codeigniter

所以我有这个问题无法从表中获取一个字符串。这是我在控制器中的方法:

    public function get_tree($id){
        $data['tree'] = $this->Product_model->get_tree($id);
        return $data;
    }

这是模型中的功能:

function get_tree($id){
    $this->db->select('ascending_path');
    $this->db->from('category');
    $this->db->where('id', $id);
    $result = $this->db->get();
    return $result;
}

我用Ajax将其显示在视图中,但似乎没有显示出来。甚至没有错误,200状态代码,并且请求显示在访问日志中。任何提示?

PS:如果我尝试json_encode它然后在ajax调用中传递dataType:json它返回的全部是:

  

{"树" {" conn_id" {" affected_rows":空," CLIENT_INFO":空," client_version":空," connect_errno":空," connect_error":空,"错误号":空,"错误":空" error_list":空,"场计数":空," host_info":空,"信息":空," INSERT_ID& #34;:空," SERVER_INFO":空," SERVER_VERSION":空," STAT":空," SQLSTATE":空, " PROTOCOL_VERSION":空,"的thread_id":空," WARNING_COUNT":空}" result_id" {" current_field&# 34;:空,"场计数":空,"长度":空," NUM_ROWS":空,"类型":空}, " result_array":[]," result_object":[]," custom_result_object":[]," CURRENT_ROW":0,&#34 ; NUM_ROWS":空," ROW_DATA":空}}

一切似乎都是空的。我甚至不知道那个对象是什么,我的意思是,查询应该只带一个字符串。

2 个答案:

答案 0 :(得分:2)

更改return $result->result(); <div class="row"> <div class="col col-33"></div> <div class="col col-33"> <img src="{{ data.logo }}" alt=""> </div> <div class="col col-33"></div> </div>

详细了解如何生成查询结果here

答案 1 :(得分:1)

使用此

protected void eventHandler(object sender, DevExpress.Web.SomethingTreeViewEvent e){

  //figure out color mapping, may depend on date and time, whatever.

  foreach (node in in mytree)
     node.textColor = colorMapping(mappingFunc(node));
}