用户
 找回密码
 入住 CI 中国社区
搜索
查看: 4273|回复: 5
收起左侧

[HELP] 新手,4096问题要怎么解决?

[复制链接]
发表于 2010-4-25 17:57:08 | 显示全部楼层 |阅读模式
这是错误信息:A PHP Error was encountered
Severity: 4096

Message: Object of class stdClass could not be converted to string

Filename: libraries/Table.php

Line Number: 269

代码:
控制器
function listing()
  {
    $this->load->library('table');
   
    $this->load->model('blogmodel','',TRUE);
    $students_qry = $this->blogmodel->listStudents();

    // generate HTML table from query results
    $students_table = $this->table->generate($students_qry);
   
    // display information for the view
    $data['title'] = "Classroom: Student Listing";
    $data['headline'] = "Student Listing";
    $data['include'] = 'student_listing';

    $data['data_table'] = $students_table;

    $this->load->view('blog_view', $data);
  }

模型:function listStudents() {
$query=$this->db->get('demo');
return $query->result();
}

视图:<?php echo $data_table; ?>
发表于 2010-4-25 23:51:49 | 显示全部楼层
269 行是什么内容?
发表于 2010-4-26 02:35:25 | 显示全部楼层
var_dump($students_qry);
看输出的是什么
 楼主| 发表于 2010-4-26 20:28:43 | 显示全部楼层
就几十行程序,269行可能是帮助文件里面的
 楼主| 发表于 2010-4-26 20:29:56 | 显示全部楼层
var_dump($student_qry)输出:array(5) { [0]=> object(stdClass)#15 (3) { ["id"]=> string(1) "1" ["title"]=> string(6) "title1" ["content"]=> string(8) "content1" } [1]=> object(stdClass)#16 (3) { ["id"]=> string(1) "2" ["title"]=> string(6) "title2" ["content"]=> string(10) "content2 " } [2]=> object(stdClass)#17 (3) { ["id"]=> string(1) "3" ["title"]=> string(6) "title3" ["content"]=> string(10) "content3 " } [3]=> object(stdClass)#18 (3) { ["id"]=> string(1) "4" ["title"]=> string(6) "title4" ["content"]=> string(10) "content4 " } [4]=> object(stdClass)#19 (3) { ["id"]=> string(1) "5" ["title"]=> string(6) "title5" ["content"]=> string(10) "content5 " } }
发表于 2010-4-27 09:37:18 | 显示全部楼层
毫无疑问楼主是没按照手册的方法使用 Table 类库。
希望楼主好好看看手册。

本版积分规则