我没有这个问题的MVC数据,但您可以通过其他示例来帮助我
Here is Your controller as Demo.php:
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Demo extends CI_Controller {
public function __construct(){
parent::__construct();
}
$this->load->model('demo_model');
$this->load->helper('url');
function display_content()
{
$data = array();
$data['result'] = $this->demo_model->get_records();
$this->load->view('demo/show_content', $data);
}
}
Your model as demo_model.php :
class demo_model extends CI_Model
{
function get_records()
{
$this->db->select('your tbl columns'); //Ex: u_id,fname,lname
$this->db->from('your tbl name'); // tbl_user
$this->db->order_by("title", "desc"); //u_id
$query = $this->db->get();
return $result = $query->result();
}
}
Your view file as show_content.php :
<table>
<tr>
<th>All Records</th>
</tr>
<?php foreach($result as $res): ?>
<tr><?php echo $res->content; ?></tr>
<?php endforeach; ?>
</table>
?>
This is sample, now you have to set-up all parameters as per your need...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.