我不能选择,请帮我找出错误MySQL的数据加载到视图。 谢谢。
视图
<div class="grid">
<div class="row">
<?php $this->load->view('admin/admin_topmenu.php'); ?>
</div>
<div class="row">
<div class="span10 box" style="padding: 10px;">
<p>Recent Messages</p>
<table class="table hovered">
<thead>
<tr class="selected">
<th class="text-left">Name</th>
<th class="text-left">Email</th>
<th class="text-left">Phone</th>
<th class="text-left">Message</th>
</tr>
</thead>
<tbody>
<?php echo form_open('admin_forms/inbox') ?><!-- start of the form -->
<?php if(isset($records)) : foreach($records as $row) : ?>
<tr>
<td class="right"><?php echo $row->contactus_name; ?></td>
<td class="right"><?php echo $row->contactus_email; ?></td>
<td class="right"><?php echo $row->contactus_phone; ?></td>
<td class="right tertiary-text-secondary text-justify"><?php echo $row->contactus_comment; ?></td>
</tr>
<?php endforeach; ?>
<?php endif; ?>
<?php echo form_close(); ?><!-- END of the form -->
</tbody>
<tfoot></tfoot>
</table>
</div>
<div class="span3">
<nav class="sidebar light">
<ul>
<li>
<a href="#">
<i class="icon-home"></i>
Inbox <strong>(5)</strong>
</a>
</li>
<li>
<a href="#">
<i class="icon-home"></i>
Send
</a>
</li>
<li>
<a href="#">
<i class="icon-home"></i>
Newsletter/Ad
</a>
</li>
</ul>
</nav>
</div>
</div>
调节器
<?php class Admin extends CI_Controller {
function index()
{
}
function inbox()
{
$data = array();
if($query = $this->mod_contactus->get_records())
{
$data['records'] = $query;
}
$this->load->view('admin/admin_messages',$data);
}
}
模型
<?php
class Mod_contactus extends CI_Model
{
function get_records()
{
$query = $this->db->get('tbl_contactus');
return $query->result();
}
function add_record($data)
{
$this->db->insert('tbl_contactus', $data);
return;
}
function update_record()
{
}
}
当我去的网页的源代码单击窗体POST方法它给了我404找不到网页错误。