【发布时间】:2015-07-23 13:23:25
【问题描述】:
这里在查看页面上出现错误,我是 codeigniter 新手,请帮助我...
这个在查看页面
foreach($this->m->gettable() as $row)
{
echo "<tr>
<td>$row->id</td>
<td>$row->studentname</td>
<td>$row->gender</td>
<td>$row->phone</td>
<td></td>
</tr>";
}
在模型页面中
function gettable()
{
$query=$this->db->get('tblstudent');
return $query->result();
}
在控制器页面中
public function _construct()
{
parent::_construct();
//call model
$this->load->model("StudentModel","m");
}
function index()
{
$this->load->view("index");
}
function savedata()
{
//create array for get data from index
$data=array(
'studentname' => $this->input->post('studentname'),
'gender' => $this->input->post('gender'),
'phone' => $this->input->post('phone')
);
//mean that insert into database table name tblstudent
$this->db->insert('tblstudent',$data);
//mean that when insert already it will go to page index
redirect("Student/index");
}
【问题讨论】:
-
你的型号是什么?
-
语法错误 /typo =>
_construct- 我在一小时内看到的第三个。你们都是从同一个地方获取相同的代码吗?! 叹息 -
@Bhandhavya Reddy 缩短你的问题标题
标签: php html codeigniter