数据库出错
错误编号:1054
未知列'//我需要一个有用的解决方案来解决这个错误,经过几个小时的调查-tigating。还是一样的。有人吗?
function update_post($postID,$data){
$this->where('postID',$postID); //error line
$this->db->update('posts',$data);
}
//code of posts.php
function editpost($postID){
$data['success']=0;
if($_POST){
$data_post=array(
'title'=>$_POST['title'],
'post'=>$_POST['post'],
'active'=>1
);
$this->post->update_post($postID,$data); // update_post function
$data['success']=1;
}
$data['post']=$this->post->get_post($postID);
$this->load->view('edit_post',$data);
}
您似乎没有将$data_post的值传递给函数,而是将$data
$data_post=array(
'title'=>$_POST['title'],
'post'=>$_POST['post'],
'active'=>1
);
$this->post->update_post($postID,$data); // update_post function
应:$data_post=array(
'title'=>$_POST['title'],
'post'=>$_POST['post'],
'active'=>1
);
$this->post->update_post($postID,$data_post); // update_post function