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

[已解决] 为什么加了读取数据库的操作后 就没有反应了呢?

[复制链接]
发表于 2010-1-18 11:36:12 | 显示全部楼层 |阅读模式
function index()
{
  
  $this->load->model('Report_model');
  $data['report'] = $this->Report_model->gettop(5);
  $this->load->view('template',$data);
}


<?php
class Report_model extends Model
{
function Report_model()
{
     parent::Model();
  }

function gettop($num)
{
  $data = array();
  $this->db->selcet('id,title,category,timestamp');
  $this->db->order_by('id','desc');
  $this->db->limit($num,0);
  $Q = $this->db->get('mwc_article');
  if($Q->num_rows()>0)
  {
   foreach ($Q->result_array() as $row)
   {
           $data[] = $row;
         }
  }
  $Q->free_result();
  return $data;
  
}

function getall()
{
  ;
}
}
?>
 楼主| 发表于 2010-1-18 11:37:28 | 显示全部楼层
index这个方法页面显示空白 啥都看不到~~~
发表于 2010-1-18 13:19:54 | 显示全部楼层
config开启debug,查CI log看停在哪了
 楼主| 发表于 2010-1-18 13:41:56 | 显示全部楼层
Undefined property: CI_Loader:Report_model
这个error不应该呀
 楼主| 发表于 2010-1-18 13:50:05 | 显示全部楼层
debug停止在EBUG - 2010-01-18 13:49:20 --> Model Class Initialized
没有发现error呀 还是不行
 楼主| 发表于 2010-1-18 14:30:18 | 显示全部楼层
太粗心了 select写错~~~
发表于 2010-1-18 14:31:02 | 显示全部楼层
你的控制器是不是class Index extends Controller ?
如果是的话,请修改控制器名字,CI控制器不能以Index命名
 楼主| 发表于 2010-1-19 09:12:07 | 显示全部楼层
结贴:是自己太粗心了 将select写错。。
在这里学到一点 就是ci的debug模式。调试代码很有用。

本版积分规则