|
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()
{
;
}
}
?> |
|