誰でも私がdbデータを取得し、それをhtmlテーブルで表示する方法を手伝ってください. htmlテーブルで表示するため。
コントローラ
class edit_content extends CI_Controller {
function edit_content()
{
parent::__construct();
$this->load->model('editcontent_model');
$this->load->helper('url');
$this->load->library('acl');
$this->data = $this->editcontent_model->get_contents();
}
}
意見
<table>
<tr>
<th>Content</th>
</tr>
<?php foreach($this->data as $r): ?>
<tr>
<tr><?php echo $r['content']; ?>
</tr>
<?php endforeach; ?>
<table>
モデル
class editcontent_model extends CI_Model {
var $CI;
function editcontent_model(){
parent::__construct();
}
function get_contents() {
$this->db->select('content');
$this->db->from('contents');
$query = $this->db->get();
return $result = $query->result();
$this->load->view('edit_content/edit_content', $result);
}
}