我想使用codeigniter显示这个结果 [英] i want to display this result using codeigniter

查看:193
本文介绍了我想使用codeigniter显示这个结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为exam_time_table的表。我想得到每个类的时间表。我试图得到结果。但它没有得到。

i have a table named exam_time_table. i want to get the time table of each class. i tried to get the result.but its not getting.

控制器

public function index()
    {
       $this->load->model('exam_model','exam');
           $data['exam_data']=$this->exam->select_data();
           $this->load->view('welcome_message',$data);
    }

模型

public function select_data() {
        $this->db->distinct();
        $this->db->select('*');
        $this->db->from('exam_time_table');
        $this->db->group_by('extt_std');
        $query = $this->db->get();
return $query->result();
       }

查看

<?php
foreach($exam_data as $exam)
{
echo $exam->extt_id;
echo $exam->extt_sub;
echo $exam->extt_date;
}

?>

推荐答案

如果您有两个模型类加载,例如

if you have two model class than load like

   $this->load->model(array('exam_model', 'exam'));

或载入

  $this->load->model('exam_model');

  $this->load->model('exam');

这篇关于我想使用codeigniter显示这个结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆